﻿namespace Vdc.Grid
{
    using Vdc.Grid.Design;
    using Vdc.Interface;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.ComponentModel.Design;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Design;
    using System.Globalization;
    using System.IO;
    using System.IO.Compression;
    using System.Runtime.CompilerServices;
    using System.Runtime.Serialization.Formatters.Binary;
    using System.Text;
    using System.Threading;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Xml;

    [ToolboxData("<{0}:Grid runat=server></{0}:Grid>"), Designer(typeof(GridDesigner), typeof(IDesigner)), ParseChildren(true), PersistChildren(false)]
    public class Grid : CompositeDataBoundControl, INamingContainer, IPostBackDataHandler, IPostBackEventHandler, ICallbackEventHandler
    {
        private string __ViewState;
        private string _callbackResultSeparator = "___|=|***|=|___";
        private GridClientSideEvents _clientSideEvents = new GridClientSideEvents();
        private string _commandsToExecute;
        private GridCssSettings _cssSettings = new GridCssSettings();
        private GridExportingSettings _exportingSettings = new GridExportingSettings();
        private bool _IsCallback;
        internal bool _isDesignTimeRender;
        private bool _isDesignTimeRenderChecked;
        internal bool _isVirtualScrolling;
        private GridLocalizationSettings _localizationSettings = new GridLocalizationSettings();
        private GridMasterDetailSettings _masterDetailSettings = new GridMasterDetailSettings();
        private string _parametersForCommandsToExecute;
        private bool _raiseSelectEvent;
        private GridScrollingSettings _scrollingSettings = new GridScrollingSettings();
        private ArrayList _SelectedRecords;
        private GridRecordEventArgs _selectEventArgs;
        private TemplatesCollection _Templates = new TemplatesCollection();
        private GridTemplateSettings _templateSettings = new GridTemplateSettings();
        private GridAddEditDeleteSettings addEditDeleteSettings = new GridAddEditDeleteSettings();
        private ArrayList additionalClientScripts;
        private bool AllowRebinding;
        private string ArrayElementsSeparator = "*_o_asep_*";
        internal string[] arrCellDivsWidth;
        internal ArrayList ArrGroupByColumns = new ArrayList();
        internal ArrayList ArrMasterRowsForDetailGridToBeLoaded;
        private bool AutoGeneratedColumnsCreated;
        internal Hashtable AvailableDetailGrids;
        private GridAddEditDeleteSettings Backup_AddEditDeleteSettings;
        private ColumnCollection Backup_Columns;
        private GridFilteringSettings Backup_FilteringSettings;
        private GridGroupingSettings Backup_GroupingSettings;
        private GridPagingSettings Backup_PagingSettings;
        private GridScrollingSettings Backup_ScrollingSettings;
        private bool bColumnTypesLoaded;
        private GridBody body;
        protected Table bodyTable;
        internal GridCallbackError CallbackError;
        private GridRenderContainer callbackErrorContainer;
        private string CellDivsWidth;
        private HtmlInputHidden CellDivsWidthContainer;
        private ArrayList cellPostbackModeTemplates;
        private ArrayList cellTemplates;
        private int childControlsCreatedCount;
        internal bool childControlsCreatedFromRealDataSource;
        internal bool clearDataSourceSelectArgumentsSortExpression;
        private HtmlInputHidden ClientFilterExpressionContainer;
        private ColumnCollection Cols = new ColumnCollection();
        internal List<int> columnIndexesToExport;
        protected static readonly object ColumnsCreatedKey = new object();
        protected static readonly object ColumnsCreatingKey = new object();
        private bool ColumnsDeserializationApplied;
        private GridColumnsFooter columnsFooter;
        private bool ColumnsIndexesGenerated;
        public HtmlInputHidden ColumnsVisibleStateContainer;
        public string ColumnsVisibleStateContainerTempValue;
        private string ColumnsWidth;
        private HtmlInputHidden ColumnsWidthContainer;
        private GridRecordEventArgs CommandData;
        private string CommandExecuted = "";
        private string CommandNameValueSeparator = "*_o_eg_*";
        private ArrayList CommandsData;
        private bool commandsExecuted;
        private ArrayList CommandsExecuted;
        private GridRenderContainer commandsParametersContainer;
        private string CommandsSeparator = "*_o_csep_*";
        private string CommandVariableSeparator = "*_o_sep_*";
        private Literal copyrightMessageEnd;
        private Literal copyrightMessageStart;
        private string CSSPath = "";
        private int customDataRowsNumber;
        private object dataItem;
        internal ArrayList dataRows = new ArrayList();
        internal ArrayList DataSourceColumnNames = new ArrayList();
        protected static readonly object DataSourceNeededKey = new object();
        private string dataSourceSelectArgumentsSortExpression;
        private string dataSourceSortExpression;
        private DetailGridCollection detailGrids = new DetailGridCollection();
        private int detailsExpanderCellWidth = 20;
        private bool displayHtmlMarkup = true;
        internal bool displayTopFooter;
        private string[] EditRecordValues;
        private GridRenderContainer editTemplatesContainer;
        private GridElementsClientIds elementsClientIds;
        private Literal elementsClientIdsContainer;
        private bool emptyDataBindingExecuted;
        protected bool emptyDetailGridRemoved;
        private bool enableUnitTests;
        private bool evaluationExpired;
        internal string executedCommandType;
        private HtmlInputHidden expandedMasterRowsContainer;
        private GridCellDivContainer exportedFileNameContainer;
        internal Table exportedGrid;
        protected static readonly object ExportedKey = new object();
        protected static readonly object ExportingKey = new object();
        internal string exportType;
        private GridFilter filter;
        private GridRenderContainer filterButtonsTemplatesContainer;
        internal HtmlInputHidden FilteringButtonsConfiguration;
        internal string FilteringButtonsConfigurationValue = "";
        protected static readonly object FilteringKey = new object();
        private GridFilteringSettings filteringSettings = new GridFilteringSettings();
        private ArrayList filterOptionsTemplates;
        private HtmlContainer filterOptionsTemplatesContainer;
        private ArrayList filterTemplates;
        private GridFooter footer;
        private HtmlContainer footerCornersContainer;
        private Table footerTable;
        private bool forceAllRecordsLoading;
        internal bool forceLanguageReloading = true;
        internal string gridID;
        private Literal gridObjectInformationEnd;
        private Literal gridObjectInformationStart;
        private GridRowCollection gridRows;
        private GridGroupingArea groupingArea;
        private bool groupingExpressionHandled;
        private GridGroupingSettings groupingSettings = new GridGroupingSettings();
        internal bool handleDataSourceCount = true;
        internal bool handleDataSourceFiltering = true;
        internal bool handleDataSourcePaging = true;
        internal bool handleDataSourceSorting = true;
        protected bool hasChildControlsCreated;
        internal bool hasColumnsWithFixedAndPercentageWidth;
        internal bool hasColumnsWithFixedAndPercentageWidthCalculated;
        internal bool HasRowObjects;
        private GridHeader header;
        private HtmlContainer headerCornersContainer;
        private Table headerTable;
        private GridHeading heading;
        internal Column HelperColumnForFixedColumns;
        private GridHorizontalScroller horizontalScroller;
        private List<HtmlLink> htmlLinksAddedToHead;
        private string ImagesPath = "";
        internal GridImagesURL ImagesURL = new GridImagesURL();
        internal int indexOfFirstVisibleColumn = -1;
        internal int indexOfLastVisibleColumn = -1;
        internal bool internalDataBinding;
        protected IEnumerable internalDataSource;
        private bool isDuringRebinding;
        internal bool isExporting;
        internal bool IsInsideReloadingBranch;
        internal bool IsPostBack;
        internal Hashtable LastUsedDetailGridID = new Hashtable();
        internal Hashtable LastUsedDetailGridIndex = new Hashtable();
        private GridRenderContainer mainContainer;
        internal Hashtable ManageDetailGridIdsOnPostback = new Hashtable();
        private GridRenderContainer multiRecordTemplateSettingsContainer;
        internal Vdc.Grid.ScriptManagerHelper MyScriptManager;
        internal bool NeedRebinding;
        private bool NeedsRebindForStyleSheet;
        private bool NeedToApplyRebinding;
        private GridRenderContainer newRecordEditTemplateContainer;
        private ArrayList NewSelectedRecords;
        private string ObjectPropertiesSeparator = "*_o_osep_*";
        private HtmlInputHidden oSortExpression;
        private HtmlInputHidden oSortOrder;
        internal PagedDataSource pagedDataSource;
        private GridHtmlInputHidden PageSelector;
        private GridPagingSettings pagingSettings = new GridPagingSettings();
        private Button postbackElement;
        protected bool preventPreviousDataSourceClearing;
        private Hashtable previouslyGroupedValues;
        private bool RecordInAddMode;
        internal int RecordInEditMode = -1;
        private string recordStyleDisplay;
        private string RelativePathToExportedFile = "";
        protected bool renderFooter = true;
        internal NameValueCollection RootGridPostCollection;
        internal string RootGridPostDataKey;
        protected static readonly object RowCreatedKey = new object();
        protected static readonly object RowDataBoundKey = new object();
        private Control RowEditTemplate;
        private GridRenderContainer rowEditTemplateContainer;
        protected static readonly object RowExportedKey = new object();
        private int rowIndex;
        internal ArrayList RowIndexesWithoutDetails;
        internal ArrayList RowObjects = new ArrayList();
        private DataTable SchemaTable;
        private GridCellDivContainer scriptContainerForDetailGrid;
        private TableCell scrollingCell;
        private string sDLLVersion = "7.0.7";
        private GridRenderContainer secondMainContainer;
        private HtmlInputHidden SelectedRecordsContainer;
        internal HtmlInputHidden SelectedRecordsIndexesContainer;
        private string SelectedRecordsString;
        internal string selectedRowsIndexes;
        private HtmlInputHidden SerializedColumnsContainer;
        private string SerializedFilterExpression = "";
        internal bool SetCellDivsWidth;
        internal int StartRowIndex = 1;
        internal string sTempSerializedColumnsString = "";
        internal bool storeBindingInformationForPreRender;
        private string StoredExportInfo;
        protected static readonly object TemplatesCreatedKey = new object();
        private GridFooter topFooter;
        private GridRenderContainer topNewRecordEditTemplateContainer;
        private GridHtmlInputHidden TotalNumberOfRecordsContainer;
        internal int TotalRecords;
        private bool UpdateColumnsWidth;
        internal bool UseEmbeddedImages;
        private bool ViewStateChanged;
        private HtmlInputHidden ViewStateContainer;
        private GridRowCollection viewStateRows;

        public event DefaultEventHandler ColumnsCreated
        {
            add
            {
                base.Events.AddHandler(ColumnsCreatedKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(ColumnsCreatedKey, value);
            }
        }

        public event DefaultEventHandler ColumnsCreating
        {
            add
            {
                base.Events.AddHandler(ColumnsCreatingKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(ColumnsCreatingKey, value);
            }
        }

        public event GridDataSourceNeededEventHandler DataSourceNeeded
        {
            add
            {
                base.Events.AddHandler(DataSourceNeededKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(DataSourceNeededKey, value);
            }
        }

        public event EventHandler DeleteCommand;

        public event GridExportEventHandler Exported
        {
            add
            {
                base.Events.AddHandler(ExportedKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(ExportedKey, value);
            }
        }

        public event GridExportEventHandler Exporting
        {
            add
            {
                base.Events.AddHandler(ExportingKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(ExportingKey, value);
            }
        }

        public event System.EventHandler Filtering
        {
            add
            {
                base.Events.AddHandler(FilteringKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(FilteringKey, value);
            }
        }

        public event EventHandler InsertCommand;

        public event DefaultEventHandler Rebind;

        public event GridRowEventHandler RowCreated
        {
            add
            {
                base.Events.AddHandler(RowCreatedKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(RowCreatedKey, value);
            }
        }

        public event GridRowEventHandler RowDataBound
        {
            add
            {
                base.Events.AddHandler(RowDataBoundKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(RowDataBoundKey, value);
            }
        }

        public event GridRowExportEventHandler RowExported
        {
            add
            {
                base.Events.AddHandler(RowExportedKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(RowExportedKey, value);
            }
        }

        public event EventHandler Select;

        public event System.EventHandler TemplatesCreated
        {
            add
            {
                base.Events.AddHandler(TemplatesCreatedKey, value);
            }
            remove
            {
                base.Events.RemoveHandler(TemplatesCreatedKey, value);
            }
        }

        public event EventHandler UpdateCommand;

        public Grid()
        {
            this.Cols.Grid = this;
        }

        protected virtual void AddStyleSheetReferenceForInterfaceControl(string stylesheetFolder, Type type, string linkToEmbeddedStyleSheet, bool addToHeader)
        {
            string webResourceUrl;
            if (!string.IsNullOrEmpty(this.FolderStyle))
            {
                webResourceUrl = Path.Combine(stylesheetFolder, "style.css").Replace(@"\", "/");
                if (webResourceUrl.IndexOf("~") == 0)
                {
                    webResourceUrl = base.ResolveUrl(webResourceUrl);
                }
            }
            else
            {
                webResourceUrl = this.Page.ClientScript.GetWebResourceUrl(type, linkToEmbeddedStyleSheet);
            }
            if ((this.IsDesignTimeRender || !this.MyScriptManager.isAjax) || !this.MyScriptManager.IsInAsyncPostBack())
            {
                HtmlLink child = new HtmlLink();
                child.Attributes.Add("type", "text/css");
                child.Attributes.Add("rel", "stylesheet");
                child.Attributes.Add("display", "all");
                child.Href = webResourceUrl;
                if (!addToHeader)
                {
                    this.Controls.Add(child);
                }
                else
                {
                    this.Page.Header.Controls.Add(child);
                    if (this.htmlLinksAddedToHead != null)
                    {
                        this.htmlLinksAddedToHead.Add(child);
                    }
                }
            }
            else
            {
                this.MyScriptManager.RegisterClientScriptBlock(type.ToString() + "StyleSheet", Vdc.Grid.JSHelper.AddStyleSheet(webResourceUrl, this.ID), true);
            }
        }

        protected virtual IEnumerable ApplyCriteriasToDataSource(IEnumerable internalDataSource)
        {
            DataView view = internalDataSource as DataView;
            if (!string.IsNullOrEmpty(this.dataSourceSortExpression) && this.handleDataSourceSorting)
            {
                view.Sort = this.dataSourceSortExpression;
            }
            if (!string.IsNullOrEmpty(this.FilterExpression) && this.handleDataSourceFiltering)
            {
                view.RowFilter = this.FilterExpression;
            }
            return view;
        }

        protected virtual void BackupProperties()
        {
            this.Backup_Columns = new ColumnCollection();
            foreach (Column column in this.Columns)
            {
                Column oCol = column.Clone() as Column;
                this.Backup_Columns.Add(oCol);
            }
            this.Backup_FilteringSettings = this.filteringSettings.Clone() as GridFilteringSettings;
            this.Backup_GroupingSettings = this.groupingSettings.Clone() as GridGroupingSettings;
            this.Backup_ScrollingSettings = this.ScrollingSettings.Clone() as GridScrollingSettings;
            this.Backup_PagingSettings = this.PagingSettings.Clone() as GridPagingSettings;
            this.Backup_AddEditDeleteSettings = this.AddEditDeleteSettings.Clone() as GridAddEditDeleteSettings;
        }

        private void CalculateContainerWidth()
        {
            int n = 0;
            foreach (Column column in this.Columns)
            {
                if (column != this.HelperColumnForFixedColumns)
                {
                    if ((column.Width == "") || (column.Width.IndexOf("%") != -1))
                    {
                        n = 0;
                        break;
                    }
                    if (column.RealVisible)
                    {
                        n += int.Parse(column.Width.Replace("px", ""), CultureInfo.InvariantCulture);
                    }
                }
            }
            if (n != 0)
            {
                this.Width = Unit.Pixel(n);
            }
            else if (string.IsNullOrEmpty(this.Width.ToString()))
            {
                this.Width = Unit.Pixel(600);
            }
        }

        private bool CheckAjaxPageInheritance()
        {
            Type baseType = this.Page.GetType().BaseType;
            while (baseType != null)
            {
                if (baseType.ToString() == "OboutInc.oboutAJAXPage")
                {
                    return true;
                }
                try
                {
                    baseType = Activator.CreateInstance(baseType).GetType().BaseType;
                    continue;
                }
                catch (Exception exception1)
                {
                    if (exception1 != null)
                    {
                    }
                    return false;
                }
            }
            return false;
        }

        private bool CheckColumnsWithCustomFilterOptions()
        {
            foreach (Column column in this.Columns)
            {
                if (column.FilterOptions.Count > 0)
                {
                    return true;
                }
            }
            return false;
        }

        protected virtual void CheckDataSourceNeeded()
        {
            if (((this.DataSource == null) && !base.IsBoundUsingDataSourceID) && ((!this.IsPostBack || (this is DetailGrid)) || !this.Serialize))
            {
                this.OnDataSourceNeeded();
            }
        }

        private void CheckExpiration()
        {
            //if (DateTime.Compare(DateTime.Now, new DateTime(0x7dc, 12, 4)) >= 0)
            //{
            //    this.evaluationExpired = true;
            //}
            //if (DateTime.Compare(DateTime.Now, new DateTime(0x7dc, 12, 0x12)) >= 0)
            //{
            //    this.displayHtmlMarkup = false;
            //}
            this.evaluationExpired = false;
            this.displayHtmlMarkup = true;
        }

        protected virtual void CheckIfNeedsEmptyDataSource()
        {
            if (((this.internalDataSource == null) || !this.childControlsCreatedFromRealDataSource) && !base.IsBoundUsingDataSourceID)
            {
                DataSet set = new DataSet();
                DataTable table = new DataTable();
                set.Tables.Add(table);
                this.preventPreviousDataSourceClearing = true;
                this.DataSource = set;
                this.preventPreviousDataSourceClearing = false;
                this.emptyDataBindingExecuted = true;
                this.PerformDataBinding(this.DataSource as IEnumerable);
            }
        }

        protected bool CheckIfNeedsRebinding()
        {
            if (this.NeedRebinding)
            {
                return true;
            }
            if (this.Columns.Count != this.Backup_Columns.Count)
            {
                return true;
            }
            for (int i = 0; i < this.Columns.Count; i++)
            {
                if (!this.Columns[i].Equals(this.Backup_Columns[i]))
                {
                    return true;
                }
            }
            string serializedFilterExpression = this.SerializedFilterExpression;
            this.SetFilterExpression(false, false);
            return ((this.SerializedFilterExpression != serializedFilterExpression) || (((this.FilteringSettings != null) && !this.FilteringSettings.Equals(this.Backup_FilteringSettings)) || (((this.GroupingSettings != null) && !this.GroupingSettings.Equals(this.Backup_GroupingSettings)) || (((this.ScrollingSettings != null) && !this.ScrollingSettings.Equals(this.Backup_ScrollingSettings)) || (((this.PagingSettings != null) && !this.PagingSettings.Equals(this.Backup_PagingSettings)) || ((this.AddEditDeleteSettings != null) && !this.AddEditDeleteSettings.Equals(this.Backup_AddEditDeleteSettings)))))));
        }

        internal int[] CheckMultiPageGroupOfRecords(int rowIndex, string dataField)
        {
            int num5;
            int[] numArray = new int[] { 0, 0, 0, 0 };
            int num = 0;
            int num2 = 0;
            int num3 = 0;
            int num4 = 0;
            GridRowCollection rows = this.ConvertDataSourceToGridRowCollection();
            if ((rowIndex < 0) || (rowIndex >= rows.Count))
            {
                return numArray;
            }
            string hashValueByDataField = this.GetHashValueByDataField(rows[rowIndex].ToHashtable(), dataField);
            try
            {
                num5 = this.GetPageSize(true) * (this.CurrentPageIndex + 1);
                if (rows[num5] != null)
                {
                    if (this.GetHashValueByDataField(rows[num5].ToHashtable(), dataField) != hashValueByDataField)
                    {
                        num = 0;
                    }
                    else
                    {
                        num4 = num5 - rowIndex;
                        for (int i = num5; i < rows.Count; i++)
                        {
                            if (!(this.GetHashValueByDataField(rows[i].ToHashtable(), dataField) == hashValueByDataField))
                            {
                                goto Label_00DD;
                            }
                            num3++;
                            num++;
                        }
                    }
                }
            }
            catch (Exception exception1)
            {
                if (exception1 != null)
                {
                }
            }
        Label_00DD:
            try
            {
                if (this.CurrentPageIndex > 0)
                {
                    num5 = rowIndex - 1;
                    if (this.GetHashValueByDataField(rows[num5].ToHashtable(), dataField) != hashValueByDataField)
                    {
                        num2 = 0;
                    }
                    else
                    {
                        for (int j = num5; j >= 0; j--)
                        {
                            if (!(this.GetHashValueByDataField(rows[j].ToHashtable(), dataField) == hashValueByDataField))
                            {
                                goto Label_0151;
                            }
                            num3++;
                            num2++;
                        }
                    }
                }
            }
            catch (Exception exception4)
            {
                if (exception4 != null)
                {
                }
            }
        Label_0151:
            try
            {
                if (num4 == 0)
                {
                    for (int k = rowIndex; k < (this.GetPageSize(true) * (this.CurrentPageIndex + 1)); k++)
                    {
                        if (!(this.GetHashValueByDataField(rows[k].ToHashtable(), dataField) == hashValueByDataField))
                        {
                            goto Label_01A5;
                        }
                        num4++;
                    }
                }
            }
            catch (Exception exception5)
            {
                if (exception5 != null)
                {
                }
            }
        Label_01A5:
            numArray[0] = num4;
            numArray[1] = num3 + num4;
            numArray[2] = num2;
            numArray[3] = num;
            return numArray;
        }

        private bool CheckPageRecord(Hashtable record)
        {
            for (int i = this.CurrentPageIndex * this.GetPageSize(true); i < ((this.CurrentPageIndex + 1) * this.GetPageSize(true)); i++)
            {
                if (i == this.TotalRecords)
                {
                    break;
                }
                bool flag = true;
                try
                {
                    foreach (DictionaryEntry entry in this.Rows[i].ToHashtable())
                    {
                        string introduced7 = record[entry.Key.ToString()].ToString();
                        if (introduced7 != entry.Value.ToString())
                        {
                            flag = false;
                        }
                    }
                    if (flag)
                    {
                        return true;
                    }
                }
                catch (Exception exception1)
                {
                    if (exception1 != null)
                    {
                    }
                    return false;
                }
            }
            return false;
        }

        public void ClearPreviousDataSource()
        {
            if (this.AutoGenerateColumns)
            {
                this.AutoGeneratedColumnsCreated = false;
                this.Columns.Clear();
            }
            this.GroupBy = "";
            this.__ViewState = "";
            this.preventPreviousDataSourceClearing = true;
            this.DataSource = null;
            this.preventPreviousDataSourceClearing = false;
        }

        private byte[] CompressDataSet(DataSet ds)
        {
            byte[] buffer = null;
            if (ds != null)
            {
                ds.RemotingFormat = System.Data.SerializationFormat.Binary;
                BinaryFormatter formatter = new BinaryFormatter();
                MemoryStream serializationStream = new MemoryStream();
                formatter.Serialize(serializationStream, ds);
                byte[] buffer2 = serializationStream.ToArray();
                MemoryStream stream = new MemoryStream();
                DeflateStream stream3 = new DeflateStream(stream, CompressionMode.Compress);
                stream3.Write(buffer2, 0, buffer2.Length);
                stream3.Flush();
                stream3.Close();
                buffer = stream.ToArray();
                stream3.Dispose();
            }
            return buffer;
        }

        protected virtual GridRowCollection ConvertDataSourceToGridRowCollection()
        {
            List<GridRow> rows = new List<GridRow>();
            int rowIndex = 0;
            foreach (object obj2 in this.internalDataSource)
            {
                GridRow item = new GridRow(rowIndex, rowIndex, GridRowType.DataRow, DataControlRowState.Normal) {
                    DataItem = obj2
                };
                rows.Add(item);
                rowIndex++;
            }
            return new GridRowCollection(rows);
        }

        private DataSet ConvertDataViewToDataSet(DataView dv)
        {
            DataTable table;
            DataSet set = new DataSet();
            if ((dv != null) && (dv.Table != null))
            {
                table = dv.Table.Clone();
                foreach (DataRowView view in dv)
                {
                    table.ImportRow(view.Row);
                }
            }
            else
            {
                table = new DataTable();
            }
            set.Tables.Add(table);
            return set;
        }

        protected DataView ConvertICollectionToDataView(ICollection collection)
        {
            this.RowObjects = new ArrayList();
            bool flag = false;
            DataTable table = new DataTable();
            foreach (object obj2 in collection)
            {
                PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(obj2);
                if (this.AutoGenerateColumns && !this.AutoGeneratedColumnsCreated)
                {
                    this.CreateAutoGeneratedColumns(properties);
                }
                if (!flag)
                {
                    foreach (PropertyDescriptor descriptor in properties)
                    {
                        if (this.Cols.GetColumnIndexByDataField(descriptor.Name) != -1)
                        {
                            DataColumn column = new DataColumn {
                                ColumnName = descriptor.Name
                            };
                            Type propertyType = descriptor.PropertyType;
                            if (propertyType.IsGenericType && (propertyType.GetGenericTypeDefinition() == typeof(Nullable<>)))
                            {
                                propertyType = propertyType.GetGenericArguments()[0];
                            }
                            column.DataType = propertyType;
                            table.Columns.Add(column);
                        }
                    }
                    flag = true;
                }
                DataRow row = table.NewRow();
                foreach (PropertyDescriptor descriptor2 in properties)
                {
                    if (table.Columns.Contains(descriptor2.Name))
                    {
                        try
                        {
                            row[descriptor2.Name] = descriptor2.GetValue(obj2);
                        }
                        catch (Exception exception)
                        {
                            if (descriptor2.GetValue(obj2) == null)
                            {
                                row[descriptor2.Name] = DBNull.Value;
                            }
                            if (exception != null)
                            {
                                exception = null;
                            }
                        }
                    }
                }
                table.Rows.Add(row);
                if (!this.HasRowObjects)
                {
                    this.HasRowObjects = true;
                }
                this.RowObjects.Add(obj2);
            }
            return table.DefaultView;
        }

        protected IEnumerable ConvertIDataReaderToIEnumerable(IDataReader reader)
        {
            if (!reader.IsClosed)
            {
                DataSet set = new DataSet();
                do
                {
                    DataTable schemaTable = reader.GetSchemaTable();
                    DataTable table = new DataTable();
                    if (schemaTable != null)
                    {
                        for (int i = 0; i < schemaTable.Rows.Count; i++)
                        {
                            DataRow row = schemaTable.Rows[i];
                            string columnName = (string) row["ColumnName"];
                            DataColumn column = new DataColumn(columnName, (Type) row["DataType"]);
                            table.Columns.Add(column);
                        }
                        set.Tables.Add(table);
                        while (reader.Read())
                        {
                            DataRow row2 = table.NewRow();
                            for (int j = 0; j < reader.FieldCount; j++)
                            {
                                row2[j] = reader.GetValue(j);
                            }
                            table.Rows.Add(row2);
                        }
                    }
                    else
                    {
                        DataColumn column2 = new DataColumn("RowsAffected");
                        table.Columns.Add(column2);
                        set.Tables.Add(table);
                        DataRow row3 = table.NewRow();
                        row3[0] = reader.RecordsAffected;
                        table.Rows.Add(row3);
                    }
                }
                while (reader.NextResult());
                this.SchemaTable = set.Tables[0];
                return set.Tables[0].DefaultView;
            }
            if (this.SchemaTable != null)
            {
                return this.SchemaTable.DefaultView;
            }
            return null;
        }

        protected virtual void CreateAutoGeneratedColumns(PropertyDescriptorCollection pds)
        {
            if (!this.AutoGeneratedColumnsCreated && (pds != null))
            {
                foreach (PropertyDescriptor descriptor in pds)
                {
                    Column oCol = new Column {
                        DataField = descriptor.Name
                    };
                    this.Columns.Add(oCol);
                }
                this.AutoGeneratedColumnsCreated = true;
            }
        }

        protected virtual GridRenderContainer CreateBodyContainer()
        {
            GridRenderContainer container = new GridRenderContainer {
                ID = this.CreateBodyContainerID(),
                CssClass = this.CssSettings.CSSBodyContainer
            };
            this.CreateBodyContainerStyle(container);
            return container;
        }

        protected virtual string CreateBodyContainerID()
        {
            return ("ob_" + this.GridID + "BodyContainer");
        }

        protected virtual void CreateBodyContainerStyle(GridRenderContainer container)
        {
            if (this.ScrollingSettings.ScrollHeight != Unit.Pixel(0))
            {
                container.Style["height"] = this.ScrollingSettings.ScrollHeight.ToString() + "px";
            }
            else
            {
                container.Style["overflow-y"] = "visible";
            }
            if (this.ScrollingSettings.ScrollWidth != 0)
            {
                container.Style["width"] = this.ScrollingSettings.ScrollWidth.ToString() + "px";
                bool flag1 = this.ScrollingSettings.ScrollWidth.ToString() != this.Width.ToString().Replace("px", "");
            }
        }

        protected virtual Table CreateBodyTable()
        {
            Table table = new Table();
            table.Attributes["cellpadding"] = "0";
            table.Attributes["cellspacing"] = "0";
            if (this.Width.ToString() != string.Empty)
            {
                table.Attributes["width"] = (this.Width.ToString().IndexOf("%") == -1) ? this.Width.ToString() : "100%";
            }
            table.CssClass = this.CssSettings.CSSBody;
            return table;
        }

        protected virtual void CreateCallbackErrorContainer()
        {
            if ((this.CallbackMode && (this.CallbackError != null)) && !string.IsNullOrEmpty(this.ClientSideEvents.OnClientCallbackError))
            {
                this.callbackErrorContainer = new GridRenderContainer();
                this.callbackErrorContainer.ID = "ob_" + this.GridID + "CallbackError";
                this.callbackErrorContainer.Style["display"] = "none";
                GridCellDivContainer child = new GridCellDivContainer {
                    Text = !string.IsNullOrEmpty(this.CallbackError.Message) ? GridEncodingHelper.XMLCdataEncode(this.CallbackError.Message) : " "
                };
                GridCellDivContainer container2 = new GridCellDivContainer {
                    Text = this.CallbackError.CommandType.ToString()
                };
                GridRenderContainer container3 = new GridRenderContainer();
                if (this.CallbackError.Data != null)
                {
                    foreach (DictionaryEntry entry in this.CallbackError.Data)
                    {
                        GridRenderContainer container4 = new GridRenderContainer();
                        GridCellDivContainer container5 = new GridCellDivContainer {
                            Text = GridEncodingHelper.XMLCdataEncode(entry.Key.ToString())
                        };
                        GridCellDivContainer container6 = new GridCellDivContainer {
                            Text = GridEncodingHelper.XMLCdataEncode(entry.Value.ToString())
                        };
                        container4.Controls.Add(container5);
                        container4.Controls.Add(container6);
                        container3.Controls.Add(container4);
                    }
                }
                this.callbackErrorContainer.Controls.Add(child);
                this.callbackErrorContainer.Controls.Add(container2);
                this.callbackErrorContainer.Controls.Add(container3);
                this.mainContainer.Controls.Add(this.callbackErrorContainer);
            }
        }

        protected virtual void CreateCellDivsWidthContainer()
        {
            this.CellDivsWidthContainer = new HtmlInputHidden();
            this.CellDivsWidthContainer.ID = this.GetCellDivsWidthContainerID();
            if (this.SetCellDivsWidth)
            {
                this.CellDivsWidthContainer.Value = GridEncodingHelper.XMLCdataEncode(this.CellDivsWidth);
            }
            this.mainContainer.Controls.Add(this.CellDivsWidthContainer);
        }

        protected override int CreateChildControls(IEnumerable dataSource, bool dataBinding)
        {
            if (dataBinding && (dataSource != null))
            {
                this.childControlsCreatedFromRealDataSource = true;
            }
            this.InitializeParameters(dataSource, dataBinding);
            this.CheckExpiration();
            if (this.displayHtmlMarkup)
            {
                if (!this.isExporting)
                {
                    this.CreateReferencesForAppearanceResources();
                }
                this.CreatePagedDataSource();
                if (this.UpdateColumnsWidth)
                {
                    this.ResizeColumns();
                }
                if (this.internalDataBinding)
                {
                    this.OnColumnsCreated();
                }
                this.CalculateContainerWidth();
                this.LoadLanguage();
                this.gridObjectInformationStart = this.CreateGridInformationMessage();
                this.Controls.Add(this.gridObjectInformationStart);
                this.mainContainer = this.CreateMainContainer();
                this.Controls.Add(this.mainContainer);
                this.gridObjectInformationEnd = this.CreateGridInformationMessage();
                this.Controls.Add(this.gridObjectInformationEnd);
                if (!string.IsNullOrEmpty(this.TemplateSettings.HeadingTemplateId))
                {
                    this.heading = new GridHeading(this);
                    this.mainContainer.Controls.Add(this.heading);
                    if (this.IsDesignTimeRender || (this is DetailGrid))
                    {
                        this.heading.ForceEnsureChildControls();
                    }
                }
                this.displayTopFooter = this.NeedsTopFooter();
                if (this.displayTopFooter)
                {
                    this.topFooter = new GridFooter(this, true);
                    this.mainContainer.Controls.Add(this.topFooter);
                    this.topFooter.ForceEnsureChildControls();
                }
                if (this.AllowGrouping)
                {
                    this.groupingArea = new GridGroupingArea(this);
                    this.mainContainer.Controls.Add(this.groupingArea);
                    if (this.IsDesignTimeRender || (this is DetailGrid))
                    {
                        this.groupingArea.ForceEnsureChildControls();
                    }
                }
                else if (!this.displayTopFooter && string.IsNullOrEmpty(this.TemplateSettings.HeadingTemplateId))
                {
                    this.CreateHeaderCorners();
                }
                if (this.ShowHeader)
                {
                    this.header = new GridHeader(this);
                    this.mainContainer.Controls.Add(this.header);
                    this.header.ForceEnsureChildControls();
                }
                if (this.AllowFiltering && (this.FilteringSettings.FilterPosition == GridFilterPosition.Top))
                {
                    this.filter = new GridFilter(this);
                    this.mainContainer.Controls.Add(this.filter);
                    this.filter.ForceEnsureChildControls();
                }
                this.body = new GridBody(this);
                this.mainContainer.Controls.Add(this.body);
                this.body.ForceEnsureChildControls();
                if (this.ShowColumnsFooter)
                {
                    this.columnsFooter = new GridColumnsFooter(this);
                    this.mainContainer.Controls.Add(this.columnsFooter);
                    if (this.IsDesignTimeRender || (this is DetailGrid))
                    {
                        this.columnsFooter.ForceEnsureChildControls();
                    }
                }
                if (this.AllowFiltering && (this.FilteringSettings.FilterPosition == GridFilterPosition.Bottom))
                {
                    this.filter = new GridFilter(this);
                    this.mainContainer.Controls.Add(this.filter);
                    this.filter.ForceEnsureChildControls();
                }
                if (this.ScrollingSettings.ScrollWidth != 0)
                {
                    this.horizontalScroller = new GridHorizontalScroller(this);
                    this.mainContainer.Controls.Add(this.horizontalScroller);
                    if (this.IsDesignTimeRender || (this is DetailGrid))
                    {
                        this.horizontalScroller.ForceEnsureChildControls();
                    }
                }
                if (this.ShowFooter)
                {
                    this.footer = new GridFooter(this, false);
                    this.mainContainer.Controls.Add(this.footer);
                    this.footer.ForceEnsureChildControls();
                }
                this.CreateFooterCorners();
                this.CreateContainerSides();
                this.gridRows = new GridRowCollection(this.body.dataRows);
                if (!this.internalDataBinding)
                {
                    this.viewStateRows = this.gridRows;
                }
                if (!this.IsDesignTimeRender && !this.isExporting)
                {
                    this.CreateHiddenContainers();
                }
                this.OnTemplatesCreated();
            }
            if (this.evaluationExpired)
            {
                Literal child = this.CreateExpirationMessage();
                this.Controls.Add(child);
            }
            this.hasChildControlsCreated = true;
            if (this.displayHtmlMarkup)
            {
                return this.pagedDataSource.DataSourceCount;
            }
            return 0;
        }

        protected virtual void CreateClientFilterExpressionContainer()
        {
            this.ClientFilterExpressionContainer = new HtmlInputHidden();
            this.ClientFilterExpressionContainer.ID = this.GetClientFilterExpressionContainerID();
            this.ClientFilterExpressionContainer.Value = this.SerializedFilterExpression;
            HtmlContainer child = new HtmlContainer();
            child.Style["display"] = "none";
            child.Text = HttpUtility.HtmlEncode(this.SerializedFilterExpression);
            this.mainContainer.Controls.Add(this.ClientFilterExpressionContainer);
            this.mainContainer.Controls.Add(child);
        }

        protected virtual string CreateColumnsCollectionClientSideCode()
        {
            int num = 0;
            StringBuilder builder = new StringBuilder();
            foreach (Column column in this.Cols)
            {
                if (num > 0)
                {
                    builder.Append(",");
                }
                if ((!string.IsNullOrEmpty(this._templateSettings.RowEditTemplateId) && (this.RowEditTemplate != null)) && string.IsNullOrEmpty(column.TemplateSettings.RowEditTemplateControlPropertyName))
                {
                    column.TemplateSettings.RowEditTemplateControlPropertyName = this.GetControlPropertyNameForTemplate(this.RowEditTemplate.NamingContainer, column.TemplateSettings.RowEditTemplateControlId);
                }
                string str = (column.DataField != string.Empty) ? column.DataField.Replace("\"", "\\\"") : "";
                string str2 = column.Visible.ToString().ToLower();
                string str3 = column.RealVisible.ToString().ToLower();
                string str4 = column.Wrap.ToString().ToLower();
                string str5 = column.Align.ToString().ToLower();
                string str6 = column.HeaderAlign.ToString().ToLower();
                string str7 = ((column.DataField != string.Empty) && (column.Type != null)) ? column.Type.Replace("\"", "\\\"").Replace("System.", "") : "";
                string str8 = (column.DataField != string.Empty) ? column.MaxLength.ToString() : "";
                string str9 = (column.DataField != string.Empty) ? column.AllowNulls.ToString().ToLower() : "";
                string str10 = column.ReadOnly.ToString().ToLower();
                string str11 = column.AllowEdit.ToString().ToLower();
                string str12 = column.AllowDelete.ToString().ToLower();
                string str13 = column.HeaderText.Replace("\"", "\\\"");
                string str14 = column.ParseHTML.ToString().ToLower();
                string str15 = column.AllowFilter.ToString().ToLower();
                string str16 = column.ShowFilterCriterias.ToString().ToLower();
                string clientID = "";
                if (((this.cellTemplates != null) && (num < this.cellTemplates.Count)) && (this.cellTemplates[num] != null))
                {
                    if (!column.ReadOnly)
                    {
                        Control control = (Control) ((Hashtable) this.cellTemplates[num])["template"];
                        if (control != null)
                        {
                            clientID = control.ClientID;
                        }
                    }
                    else
                    {
                        clientID = "";
                    }
                }
                string str18 = !string.IsNullOrEmpty(str) ? str : ("ob_temp_col_" + column.Index.ToString());
                string str19 = "Column";
                if (column is CheckBoxSelectColumn)
                {
                    str19 = "CheckBoxSelectColumn";
                }
                StringBuilder builder2 = new StringBuilder();
                builder2.Append("new VdcGridColumn(");
                builder2.Append("\"" + str19 + "\",");
                builder2.Append("\"" + str + "\",");
                builder2.Append("\"" + str18 + "\",");
                builder2.Append(column.Index.ToString() + ",");
                builder2.Append(str2 + ",");
                builder2.Append(str3 + ",");
                builder2.Append("\"" + column.Width + "\",");
                builder2.Append(str4 + ",");
                builder2.Append("\"" + str5 + "\",");
                builder2.Append("\"" + str6 + "\",");
                builder2.Append("\"" + str7 + "\",");
                builder2.Append("\"" + str8 + "\",");
                builder2.Append("\"" + str9 + "\",");
                builder2.Append(str10 + ",");
                builder2.Append(str11 + ",");
                builder2.Append(str12 + ",");
                builder2.Append("\"" + str13 + "\",");
                builder2.Append(str14 + ",");
                builder2.Append(str15 + ",");
                builder2.Append(str16 + ",");
                builder2.Append("\"" + (((this.cellTemplates != null) && (this.cellTemplates.Count > 0)) ? column.TemplateSettings.TemplateId.ToString() : "") + "\",");
                builder2.Append("\"" + clientID + "\",");
                builder2.Append("\"" + column.TemplateSettings.FilterTemplateId + "\",");
                builder2.Append(column.AllowSorting.ToString().ToLower() + ",");
                builder2.Append("\"" + column.SortOrder.ToString() + "\",");
                builder2.Append(column.SortPriority.ToString() + ",");
                builder2.Append(column.AllowGroupBy.ToString().ToLower() + ",");
                builder2.Append(column.GroupBy.ToString().ToLower() + ",");
                builder2.Append(column.GroupByPriority.ToString() + ",");
                builder2.Append("\"" + ((!string.IsNullOrEmpty(this._templateSettings.RowEditTemplateId) && (this.RowEditTemplate != null)) ? this.GetControlIDForTemplate(this.RowEditTemplate.NamingContainer, column.TemplateSettings.RowEditTemplateControlId).Replace("\"", "\\\"") : "") + "\",");
                builder2.Append("\"" + column.TemplateSettings.RowEditTemplateControlPropertyName.Replace("\"", "\\\"") + "\",");
                builder2.Append(column.TemplateSettings.RowEditTemplateUseQuotes.ToString().ToLower() + ",");
                builder2.Append("\"" + column.TemplateSettings.ModifyTemporaryEditedRecord_TemplateId.Replace("\"", "\\\"") + "\",");
                builder2.Append("\"" + column.TemplateSettings.CancelTemporaryEditedRecord_TemplateId.Replace("\"", "\\\"") + "\",");
                builder2.Append("\"" + column.TemplateSettings.ModifyTemporaryAddedRecord_TemplateId.Replace("\"", "\\\"") + "\",");
                builder2.Append("\"" + column.TemplateSettings.CancelTemporaryAddedRecord_TemplateId.Replace("\"", "\\\"") + "\",");
                builder2.Append("\"" + column.TemplateSettings.RemoveTemporaryAddedRecord_TemplateId.Replace("\"", "\\\"") + "\",");
                builder2.Append("\"" + column.TemplateSettings.UndeleteTemporaryDeletedRecord_TemplateId.Replace("\"", "\\\"") + "\",");
                builder2.Append("\"" + column.FilterOptionsDdlID + "\",");
                builder2.Append("\"" + column.FilterControlID + "\",");
                builder2.Append("\"" + column.FilterControlPropertyName + "\",");
                builder2.Append(column.GetFilterOptionsTemplateIds() + ",");
                builder2.Append("\"" + column.GetDefaultFilterOptionID() + "\",");
                builder2.Append(column.HasCustomFilterOptionsWithTemplates().ToString().ToLower() + ",");
                if (column is CheckBoxSelectColumn)
                {
                    builder2.Append((column as CheckBoxSelectColumn).ShowHeaderCheckBox.ToString().ToLower());
                }
                else
                {
                    builder2.Append("false");
                }
                builder2.Append(")");
                builder.Append(builder2.ToString());
                num++;
            }
            return builder.ToString();
        }

        protected virtual void CreateColumnsVisibleStateContainer()
        {
            this.ColumnsVisibleStateContainer = new HtmlInputHidden();
            this.ColumnsVisibleStateContainer.ID = "ob_" + this.GridID + "VSC";
            if (this.ColumnsVisibleStateContainerTempValue != null)
            {
                this.ColumnsVisibleStateContainer.Value = this.ColumnsVisibleStateContainerTempValue;
            }
            this.mainContainer.Controls.Add(this.ColumnsVisibleStateContainer);
        }

        protected virtual void CreateColumnsWidthContainer()
        {
            this.ColumnsWidthContainer = new HtmlInputHidden();
            this.ColumnsWidthContainer.ID = this.GetColumnsWidthContainerID();
            if (this.UpdateColumnsWidth)
            {
                this.ColumnsWidthContainer.Value = GridEncodingHelper.XMLCdataEncode(this.ColumnsWidth);
            }
            this.mainContainer.Controls.Add(this.ColumnsWidthContainer);
        }

        protected virtual Hashtable CreateCommandEventArgs(string sCommandVariables)
        {
            Hashtable hashtable = new Hashtable();
            foreach (string str in this.SplitByString(sCommandVariables, this.CommandVariableSeparator))
            {
                string str3;
                string[] strArray2 = this.SplitByString(str, this.CommandNameValueSeparator);
                string sDataField = HttpUtility.UrlDecode(strArray2[0], Encoding.Default);
                if (strArray2.Length > 1)
                {
                    str3 = HttpUtility.UrlDecode(strArray2[1], Encoding.Default);
                }
                else
                {
                    str3 = "";
                }
                try
                {
                    Column columnByDataField = this.Columns.GetColumnByDataField(sDataField);
                    if (!string.IsNullOrEmpty(columnByDataField.NullDisplayText) && (columnByDataField.NullDisplayText == str3))
                    {
                        str3 = null;
                    }
                    else if (columnByDataField.ConvertEmptyStringToNull && (str3 == string.Empty))
                    {
                        str3 = null;
                    }
                }
                catch (Exception exception1)
                {
                    if (exception1 != null)
                    {
                    }
                }
                hashtable.Add(sDataField, str3);
            }
            return hashtable;
        }

        protected virtual void CreateCommandsParametersContainer()
        {
            if (((this.CommandExecuted != string.Empty) && (this.CommandData != null)) && (this.CommandData.Record != null))
            {
                this.InitializeCommandsParametersContainer();
                GridCellSpanContainer child = new GridCellSpanContainer {
                    Text = this.CommandExecuted
                };
                this.commandsParametersContainer.Controls.Add(child);
                GridCellSpanContainer container2 = new GridCellSpanContainer();
                foreach (DictionaryEntry entry in this.CommandData.Record)
                {
                    GridCellSpanContainer container3 = new GridCellSpanContainer();
                    GridCellSpanContainer container4 = new GridCellSpanContainer {
                        Text = GridEncodingHelper.XMLCdataEncode(entry.Key.ToString())
                    };
                    container3.Controls.Add(container4);
                    GridCellSpanContainer container5 = new GridCellSpanContainer();
                    if (entry.Value != null)
                    {
                        container5.Text = GridEncodingHelper.XMLCdataEncode(entry.Value.ToString());
                    }
                    else
                    {
                        container5.Text = "";
                    }
                    container3.Controls.Add(container5);
                    container2.Controls.Add(container3);
                }
                this.commandsParametersContainer.Controls.Add(container2);
                this.mainContainer.Controls.Add(this.commandsParametersContainer);
            }
            else if ((this.CommandsExecuted != null) && (this.CommandsData != null))
            {
                this.InitializeCommandsParametersContainer();
                for (int i = 0; i < this.CommandsExecuted.Count; i++)
                {
                    GridRenderContainer container6 = new GridRenderContainer();
                    GridCellDivContainer container7 = new GridCellDivContainer {
                        Text = this.CommandsExecuted[i].ToString()
                    };
                    container6.Controls.Add(container7);
                    if (this.CommandsData[i] != null)
                    {
                        GridRecordEventArgs args = this.CommandsData[i] as GridRecordEventArgs;
                        foreach (Hashtable hashtable in args.RecordsCollection)
                        {
                            GridRenderContainer container8 = new GridRenderContainer();
                            foreach (DictionaryEntry entry2 in hashtable)
                            {
                                GridRenderContainer container9 = new GridRenderContainer();
                                GridCellDivContainer container10 = new GridCellDivContainer {
                                    Text = GridEncodingHelper.XMLCdataEncode(entry2.Key.ToString())
                                };
                                GridCellDivContainer container11 = new GridCellDivContainer();
                                if (entry2.Value != null)
                                {
                                    container11.Text = GridEncodingHelper.XMLCdataEncode(entry2.Value.ToString());
                                }
                                else
                                {
                                    container11.Text = "";
                                }
                                container9.Controls.Add(container10);
                                container9.Controls.Add(container11);
                                container8.Controls.Add(container9);
                            }
                            container6.Controls.Add(container8);
                        }
                    }
                    this.commandsParametersContainer.Controls.Add(container6);
                }
                this.mainContainer.Controls.Add(this.commandsParametersContainer);
            }
        }

        protected void CreateContainers()
        {
            this.gridObjectInformationStart = this.CreateGridInformationMessage();
            this.Controls.Add(this.gridObjectInformationStart);
            this.mainContainer = this.CreateMainContainer();
            this.Controls.Add(this.mainContainer);
            this.gridObjectInformationEnd = this.CreateGridInformationMessage();
            this.Controls.Add(this.gridObjectInformationEnd);
        }

        protected void CreateContainerSides()
        {
            string str = this.AllowGrouping ? "ob_gBLSWG" : "ob_gBLS";
            string str2 = this.AllowGrouping ? "ob_gBRSWG" : "ob_gBRS";
            if (!string.IsNullOrEmpty(this.TemplateSettings.HeadingTemplateId) || this.displayTopFooter)
            {
                str = str + " ob_gBLSW" + (this.AllowGrouping ? "G" : "") + "_EL_";
                str2 = str2 + " ob_gBRSW" + (this.AllowGrouping ? "G" : "") + "_EL_";
                if (!string.IsNullOrEmpty(this.TemplateSettings.HeadingTemplateId))
                {
                    str = str + "H";
                    str2 = str2 + "H";
                }
                if (this.displayTopFooter)
                {
                    str = str + "TF";
                    str2 = str2 + "TF";
                }
            }
            HtmlContainer child = new HtmlContainer {
                CssClass = str,
                Text = ""
            };
            this.mainContainer.Controls.Add(child);
            HtmlContainer container2 = new HtmlContainer {
                CssClass = str2,
                Text = ""
            };
            this.mainContainer.Controls.Add(container2);
        }

        private Literal CreateCopyRightMessage()
        {
            return new Literal { Text = "\r\n\r\n<!--   vdc Grid component version " + this.sDLLVersion + "     www.vdc.com.vn    (.NET dll) -->\r\n\r\n" };
        }

        private void CreateDataControlFields()
        {
            if ((this.AutoGenerateColumns && !this.AutoGeneratedColumnsCreated) && this.internalDataBinding)
            {
                PropertyDescriptorCollection itemProperties = this.pagedDataSource.GetItemProperties(new PropertyDescriptor[0]);
                this.CreateAutoGeneratedColumns(itemProperties);
            }
            if (this.Columns.Count > 0)
            {
                this.OnColumnsCreating();
            }
            this.Columns.Sort();
            if ((this.ScrollingSettings.ScrollWidth != 0) && (this.ScrollingSettings.NumberOfFixedColumns > 0))
            {
                this.HelperColumnForFixedColumns = new Column();
                this.HelperColumnForFixedColumns.isHelperForScrolling = true;
                this.HelperColumnForFixedColumns.DataField = "";
                this.HelperColumnForFixedColumns.Width = this.ScrollingSettings.ScrollWidth.ToString();
                this.HelperColumnForFixedColumns.Visible = true;
                if (this.ScrollingSettings.FixedColumnsPosition == GridFixedColumnsPositionType.Left)
                {
                    this.HelperColumnForFixedColumns.Index = this.Columns.Count;
                    if (!this.Columns[this.Columns.Count - 1].isHelperForScrolling)
                    {
                        this.Columns.Add(this.HelperColumnForFixedColumns);
                    }
                }
                else
                {
                    this.HelperColumnForFixedColumns.Index = 0;
                    if (!this.Columns[0].isHelperForScrolling)
                    {
                        this.Columns.Insert(0, this.HelperColumnForFixedColumns);
                    }
                    int num = 0;
                    for (int i = this.Columns.Count - 1; i > ((this.Columns.Count - 1) - this.ScrollingSettings.NumberOfFixedColumns); i--)
                    {
                        num += int.Parse(this.Columns[i].Width);
                    }
                    int num3 = 0;
                    int num4 = int.Parse(this.ScrollingSettings.ScrollWidth.ToString().Replace("px", "")) - num;
                    int num5 = 0;
                    foreach (Column column in this.Columns)
                    {
                        if (num5 > 0)
                        {
                            if (column.Visible)
                            {
                                if ((num3 + int.Parse(column.Width)) <= num4)
                                {
                                    num3 += int.Parse(column.Width);
                                }
                                else
                                {
                                    column.RealVisible = true;
                                    column.Visible = false;
                                }
                            }
                            if (num5 == ((this.Columns.Count - 1) - this.ScrollingSettings.NumberOfFixedColumns))
                            {
                                break;
                            }
                        }
                        num5++;
                    }
                }
            }
            foreach (Column column2 in this.Columns)
            {
                column2.Initialize(this.AllowSorting, this);
            }
        }

        protected override DataSourceSelectArguments CreateDataSourceSelectArguments()
        {
            DataSourceSelectArguments arguments = new DataSourceSelectArguments();
            DataSourceView data = this.GetData();
            if (this.AllowGrouping)
            {
                this.ManageGroupBy();
                this.groupingExpressionHandled = true;
            }
            if (data.CanSort && !this.clearDataSourceSelectArgumentsSortExpression)
            {
                string sortExpression = this.GetSortExpression();
                if (this.EmbedFilterInSortExpression)
                {
                    this.SetFilterExpression(false, true);
                    if (!string.IsNullOrEmpty(this.FilterExpression))
                    {
                        sortExpression = sortExpression + "__ob_sep__" + this.FilterExpression;
                    }
                }
                if (!string.IsNullOrEmpty(sortExpression))
                {
                    arguments.SortExpression = sortExpression;
                    this.dataSourceSelectArgumentsSortExpression = sortExpression;
                }
            }
            if (data.CanPage && !this.forceAllRecordsLoading)
            {
                arguments.StartRowIndex = this.CurrentPageIndex * this.GetPageSize(true);
                arguments.MaximumRows = this.GetPageSize(true);
            }
            if (data.CanRetrieveTotalRowCount)
            {
                arguments.RetrieveTotalRowCount = true;
            }
            return arguments;
        }

        protected virtual IEnumerable CreateDesignTimeDataSource(IEnumerable internalDataSource)
        {
            try
            {
                DataTable table = ((DataView) internalDataSource).Table;
                table.Rows.Clear();
                for (int i = 0; i < ((this.PageSize != -1) ? this.PageSize : 10); i++)
                {
                    DataRow row = table.NewRow();
                    foreach (DataColumn column in table.Columns)
                    {
                        if (column.DataType.ToString() == "System.String")
                        {
                            row[column] = "abc";
                        }
                        else if (column.DataType.ToString() == "System.DateTime")
                        {
                            row[column] = DateTime.Now.ToString();
                        }
                        else
                        {
                            row[column] = i;
                        }
                    }
                    table.Rows.Add(row);
                }
            }
            catch (Exception exception1)
            {
                if (exception1 != null)
                {
                }
            }
            return internalDataSource;
        }

        protected virtual void CreateEditTemplatesContainer()
        {
            if ((!this.CallbackMode || !this.IsCallback) || this.AllowColumnReordering)
            {
                this.editTemplatesContainer = new GridRenderContainer();
                this.mainContainer.Controls.Add(this.editTemplatesContainer);
                this.editTemplatesContainer.ID = "ob_" + this.GridID + "EditTemplateContainer";
                this.editTemplatesContainer.Style["display"] = "none";
                int columnIndex = 0;
                foreach (Column column in this.Cols)
                {
                    if (((column.TemplateSettings.EditTemplateId != string.Empty) && !column.ReadOnly) && this.internalDataBinding)
                    {
                        GridTemplate child = null;
                        GridRuntimeTemplate runtimeTemplateById = null;
                        if (this.Templates.GetById(column.TemplateSettings.EditTemplateId) is GridRuntimeTemplate)
                        {
                            runtimeTemplateById = this.Templates.GetRuntimeTemplateById(column.TemplateSettings.EditTemplateId);
                            if (runtimeTemplateById == null)
                            {
                                throw new InvalidTemplateIDException(column.TemplateSettings.EditTemplateId);
                            }
                            runtimeTemplateById.Container.GridClientID = this.GridID;
                        }
                        else
                        {
                            child = this.Templates.GetById(column.TemplateSettings.EditTemplateId);
                            if (child == null)
                            {
                                throw new InvalidTemplateIDException(column.TemplateSettings.EditTemplateId);
                            }
                            child.Container.GridClientID = this.GridID;
                        }
                        if (child != null)
                        {
                            GridCellDivContainer container = new GridCellDivContainer {
                                ID = child.ClientID + "_" + columnIndex.ToString()
                            };
                            this.editTemplatesContainer.Controls.Add(container);
                            GridCellSpanContainer container2 = new GridCellSpanContainer();
                            if (string.IsNullOrEmpty(column.DataField) && (this is DetailGrid))
                            {
                                try
                                {
                                    child.DataBind();
                                }
                                catch
                                {
                                }
                            }
                            container2.Controls.Add(child);
                            container.Controls.Add(container2);
                            if ((column.DataField != string.Empty) && !column.ReadOnly)
                            {
                                GridCellSpanContainer container3 = new GridCellSpanContainer();
                                container.Controls.Add(container3);
                                container3.Text = child.ControlID;
                                GridCellSpanContainer container4 = new GridCellSpanContainer();
                                container.Controls.Add(container4);
                                container4.Text = child.ControlPropertyName;
                                GridCellSpanContainer container5 = new GridCellSpanContainer {
                                    Text = child.UseQuotes.ToString().ToLower()
                                };
                                container.Controls.Add(container5);
                            }
                            this.StoreEditTemplatesReferences(container, child, columnIndex, true);
                        }
                        if (runtimeTemplateById != null)
                        {
                            GridCellDivContainer container6 = new GridCellDivContainer {
                                ID = runtimeTemplateById.ClientID + "_" + columnIndex.ToString()
                            };
                            this.editTemplatesContainer.Controls.Add(container6);
                            GridCellSpanContainer container7 = new GridCellSpanContainer();
                            if (string.IsNullOrEmpty(column.DataField))
                            {
                                try
                                {
                                    runtimeTemplateById.DataBind();
                                }
                                catch (Exception exception1)
                                {
                                    if (exception1 != null)
                                    {
                                    }
                                }
                            }
                            container7.Controls.Add(runtimeTemplateById);
                            container6.Controls.Add(container7);
                            if ((column.DataField != string.Empty) && !column.ReadOnly)
                            {
                                GridCellSpanContainer container8 = new GridCellSpanContainer();
                                container6.Controls.Add(container8);
                                container8.Text = runtimeTemplateById.ControlID;
                                GridCellSpanContainer container9 = new GridCellSpanContainer();
                                container6.Controls.Add(container9);
                                container9.Text = runtimeTemplateById.ControlPropertyName;
                                GridCellSpanContainer container10 = new GridCellSpanContainer {
                                    Text = runtimeTemplateById.UseQuotes.ToString().ToLower()
                                };
                                container6.Controls.Add(container10);
                            }
                            this.StoreEditTemplatesReferences(container6, runtimeTemplateById, columnIndex, true);
                        }
                    }
                    else if (((column.DataField != string.Empty) && !column.ReadOnly) && string.IsNullOrEmpty(this.TemplateSettings.RowEditTemplateId))
                    {
                        if (column is CheckBoxColumn)
                        {
                            CheckBox box2 = null;
                            if (((CheckBoxColumn) column).ControlType == GridControlType.Standard)
                            {
                                box2 = new CheckBox();
                            }
                            else
                            {
                                box2 = new VdcCheckBox();
                            }
                            box2.ID = "ob_" + this.GridID + "EditControl" + columnIndex.ToString();
                            box2.Width = Unit.Percentage(100.0);
                            GridCellDivContainer container16 = new GridCellDivContainer {
                                ID = "tpl_ob_" + this.GridID + "EditControl" + columnIndex.ToString()
                            };
                            this.editTemplatesContainer.Controls.Add(container16);
                            GridCellSpanContainer container17 = new GridCellSpanContainer();
                            container17.Controls.Add(box2);
                            container16.Controls.Add(container17);
                            GridCellSpanContainer container18 = new GridCellSpanContainer();
                            bool getClientID = true;
                            if (((CheckBoxColumn) column).ControlType == GridControlType.Standard)
                            {
                                container18.Text = box2.ClientID;
                            }
                            else
                            {
                                container18.Text = box2.ID;
                                getClientID = false;
                            }
                            container16.Controls.Add(container18);
                            GridCellSpanContainer container19 = new GridCellSpanContainer {
                                Text = "checked"
                            };
                            container16.Controls.Add(container19);
                            GridCellSpanContainer container20 = new GridCellSpanContainer {
                                Text = "false"
                            };
                            container16.Controls.Add(container20);
                            this.StoreEditTemplatesReferences(container16, box2, columnIndex, getClientID);
                        }
                        else
                        {
                            VdcTextBox box = new VdcTextBox
                            {
                                ID = "ob_" + this.GridID + "EditControl" + columnIndex.ToString(),
                                FolderStyle = this.GetInterfaceFolderStyle_TextBox(),
                                Width = Unit.Percentage(100.0)
                            };
                            GridCellDivContainer container11 = new GridCellDivContainer {
                                ID = "tpl_ob_" + this.GridID + "EditControl" + columnIndex.ToString()
                            };
                            this.editTemplatesContainer.Controls.Add(container11);
                            GridCellSpanContainer container12 = new GridCellSpanContainer();
                            container12.Controls.Add(box);
                            container11.Controls.Add(container12);
                            GridCellSpanContainer container13 = new GridCellSpanContainer {
                                Text = box.ID
                            };
                            container11.Controls.Add(container13);
                            GridCellSpanContainer container14 = new GridCellSpanContainer {
                                Text = "value"
                            };
                            container11.Controls.Add(container14);
                            GridCellSpanContainer container15 = new GridCellSpanContainer {
                                Text = "true"
                            };
                            container11.Controls.Add(container15);
                            this.StoreEditTemplatesReferences(container11, box, columnIndex, false);
                        }
                    }
                    else
                    {
                        this.StoreEditTemplatesReferences(null, null, 0, true);
                    }
                    columnIndex++;
                }
            }
        }

        protected virtual void CreateElementsClientIdsContainer()
        {
            this.elementsClientIdsContainer = new Literal();
            this.mainContainer.Controls.Add(this.elementsClientIdsContainer);
        }

        protected virtual void CreateElementsClientIdsContent()
        {
            if ((this.elementsClientIdsContainer != null) && string.IsNullOrEmpty(this.elementsClientIdsContainer.Text))
            {
                this.GetElementsClientIds();
                StringBuilder builder = new StringBuilder();
                builder.Append("<div id=\"ob_" + this.GridID + "_ElementsClientIdsContainer\" style=\"display: none;\">");
                builder.Append("<div id=\"ob_" + this.GridID + "_MainContainerID\">" + this.elementsClientIds.MainContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_HeadingContainerID\">" + this.elementsClientIds.HeadingContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_GroupingAreaContainerID\">" + this.elementsClientIds.GroupingAreaContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_HeaderContainerID\">" + this.elementsClientIds.HeaderContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_BodyContainerID\">" + this.elementsClientIds.BodyContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_FooterContainerID\">" + this.elementsClientIds.FooterContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TopFooterContainerID\">" + this.elementsClientIds.TopFooterContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_HorizontalScrollerID\">" + this.elementsClientIds.HorizontalScrollerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_FilterContainerID\">" + this.elementsClientIds.FilterContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_AddRecordLinkID\">" + this.elementsClientIds.AddRecordLinkID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TopAddRecordLinkID\">" + this.elementsClientIds.TopAddRecordLinkID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_FooterActionLinksContainerID\">" + this.elementsClientIds.FooterActionLinksContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TopFooterActionLinksContainerID\">" + this.elementsClientIds.TopFooterActionLinksContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_PageSelectorID\">" + this.elementsClientIds.PageSelectorID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TotalNumberOfRecordsContainerID\">" + this.elementsClientIds.TotalNumberOfRecordsContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_PageSizeSelectorID\">" + this.elementsClientIds.PageSizeSelectorID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TopPageSizeSelectorID\">" + this.elementsClientIds.TopPageSizeSelectorID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_SerializedColumnsContainerID\">" + this.elementsClientIds.SerializedColumnsContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_SortExpressionContainerID\">" + this.elementsClientIds.SortExpressionContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_SortOrderContainerID\">" + this.elementsClientIds.SortOrderContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_ViewStateContainerID\">" + this.elementsClientIds.ViewStateContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_SelectedRecordsContainerID\">" + this.elementsClientIds.SelectedRecordsContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_SelectedRecordsIndexesContainerID\">" + this.elementsClientIds.SelectedRecordsIndexesContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_NewRecordEditTemplateContainerID\">" + this.elementsClientIds.NewRecordEditTemplateContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TopNewRecordEditTemplateContainerID\">" + this.elementsClientIds.TopNewRecordEditTemplateContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_MultiActionLinksContainerID\">" + this.elementsClientIds.MultiActionLinksContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TopMultiActionLinksContainerID\">" + this.elementsClientIds.TopMultiActionLinksContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_MultiRecordTemplateSettingsContainerID\">" + this.elementsClientIds.MultiRecordTemplateSettingsContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_HeaderScrollingCellID\">" + this.elementsClientIds.HeaderScrollingCellID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_FilteringButtonsConfigurationContainerID\">" + this.elementsClientIds.FilteringButtonsConfigurationContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_ColumnsVisibleStateContainerID\">" + this.elementsClientIds.ColumnsVisibleStateContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_ColumnsWidthContainerID\">" + this.elementsClientIds.ColumnsWidthContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_CellDivsWidthContainerID\">" + this.elementsClientIds.CellDivsWidthContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_EditTemplatesContainerID\">" + this.elementsClientIds.EditTemplatesContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_FilterOptionsTemplatesContainerID\">" + this.elementsClientIds.FilterOptionsTemplatesContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_ManualPagingTextboxID\">" + this.elementsClientIds.ManualPagingTextboxID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TopManualPagingTextboxID\">" + this.elementsClientIds.TopManualPagingTextboxID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_FooterFilterLinksContainerID\">" + this.elementsClientIds.FooterFilterLinksContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_TopFooterFilterLinksContainerID\">" + this.elementsClientIds.TopFooterFilterLinksContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_ClientFilterExpressionContainerID\">" + this.elementsClientIds.ClientFilterExpressionContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_ExportedFileNameContainerID\">" + this.elementsClientIds.ExportedFileNameContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_CommandsParametersContainerID\">" + this.elementsClientIds.CommandsParametersContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_RowEditTemplateContainerID\">" + this.elementsClientIds.RowEditTemplateContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_FilterButtonsTemplatesContainerID\">" + this.elementsClientIds.FilterButtonsTemplatesContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_CallbackErrorContainerID\">" + this.elementsClientIds.CallbackErrorContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_ExpandedMasterRowsContainerID\">" + this.elementsClientIds.ExpandedMasterRowsContainerID + "</div>");
                if (!string.IsNullOrEmpty(this.elementsClientIds.PostbackElementID))
                {
                    builder.Append("<div id=\"ob_" + this.GridID + "_PostbackElementID\">" + this.elementsClientIds.PostbackElementID + "</div>");
                }
                builder.Append("<div id=\"ob_" + this.GridID + "_LoadingMessageContainerID\">" + this.elementsClientIds.LoadingMessageContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_HeaderCornersContainerID\">" + this.elementsClientIds.HeaderCornersContainerID + "</div>");
                builder.Append("<div id=\"ob_" + this.GridID + "_FooterCornersContainerID\">" + this.elementsClientIds.FooterCornersContainerID + "</div>");
                builder.Append("</div>");
                this.elementsClientIdsContainer.Text = builder.ToString();
            }
        }

        protected virtual void CreateExpandedMasterRowsContainer()
        {
            this.expandedMasterRowsContainer = new HtmlInputHidden();
            this.expandedMasterRowsContainer.ID = "ob_" + this.GridID + "EMRC";
            this.mainContainer.Controls.Add(this.expandedMasterRowsContainer);
        }

        private Literal CreateExpirationMessage()
        {
            Literal literal;
            return new Literal { Text = "<div id=\"ob_" + this.GridID + "TrialDiv\" style=\"position:relative; top:0px; left:0px; border:1px solid gray; background-color:white; padding:5px; color:gray; font:11px Verdana; text-align:center;width:" + this.Width.ToString() + "\">"
                 + "<b>vdc Grid</b><br /><br />Evaluation has expired."
                 + "</div>" };
        }

        protected virtual void CreateFilterButtonsConfigurationContainer()
        {
            this.FilteringButtonsConfiguration = new HtmlInputHidden();
            this.FilteringButtonsConfiguration.ID = "ob_" + this.GridID + "FBConfC";
            if ((this.FilteringButtonsConfigurationValue == null) || (this.FilteringButtonsConfigurationValue == string.Empty))
            {
                this.FilteringButtonsConfigurationValue = "1";
            }
            if (this.FilteringButtonsConfigurationValue != null)
            {
                this.FilteringButtonsConfiguration.Value = this.FilteringButtonsConfigurationValue;
            }
            this.mainContainer.Controls.Add(this.FilteringButtonsConfiguration);
        }

        protected virtual void CreateFilterButtonsTemplatesContainer()
        {
            if ((!string.IsNullOrEmpty(this.TemplateSettings.FilterShowButton_TemplateId) || !string.IsNullOrEmpty(this.TemplateSettings.FilterApplyButton_TemplateId)) || (!string.IsNullOrEmpty(this.TemplateSettings.FilterHideButton_TemplateId) || !string.IsNullOrEmpty(this.TemplateSettings.FilterRemoveButton_TemplateId)))
            {
                this.filterButtonsTemplatesContainer = new GridRenderContainer();
                this.filterButtonsTemplatesContainer.ID = "ob_" + this.GridID + "FBTplC";
                this.filterButtonsTemplatesContainer.Style["display"] = "none";
                GridCellSpanContainer child = new GridCellSpanContainer();
                GridCellSpanContainer container2 = new GridCellSpanContainer();
                GridCellSpanContainer container3 = new GridCellSpanContainer();
                GridCellSpanContainer container4 = new GridCellSpanContainer();
                if (!string.IsNullOrEmpty(this.TemplateSettings.FilterShowButton_TemplateId))
                {
                    GridTemplate template = this.CreateTemplate(this.TemplateSettings.FilterShowButton_TemplateId, "", null, null, 0, 0);
                    child.Controls.Add(template);
                }
                if (!string.IsNullOrEmpty(this.TemplateSettings.FilterApplyButton_TemplateId))
                {
                    GridTemplate template2 = this.CreateTemplate(this.TemplateSettings.FilterApplyButton_TemplateId, "", null, null, 0, 0);
                    container2.Controls.Add(template2);
                }
                if (!string.IsNullOrEmpty(this.TemplateSettings.FilterHideButton_TemplateId))
                {
                    GridTemplate template3 = this.CreateTemplate(this.TemplateSettings.FilterHideButton_TemplateId, "", null, null, 0, 0);
                    container3.Controls.Add(template3);
                }
                if (!string.IsNullOrEmpty(this.TemplateSettings.FilterRemoveButton_TemplateId))
                {
                    GridTemplate template4 = this.CreateTemplate(this.TemplateSettings.FilterRemoveButton_TemplateId, "", null, null, 0, 0);
                    container4.Controls.Add(template4);
                }
                this.filterButtonsTemplatesContainer.Controls.Add(child);
                this.filterButtonsTemplatesContainer.Controls.Add(container2);
                this.filterButtonsTemplatesContainer.Controls.Add(container3);
                this.filterButtonsTemplatesContainer.Controls.Add(container4);
                this.mainContainer.Controls.Add(this.filterButtonsTemplatesContainer);
            }
        }

        private GridCellDivContainer CreateFilterOptionContainer(int index, string text)
        {
            GridCellDivContainer container = new GridCellDivContainer();
            container.Attributes["onclick"] = this.GridID + ".setFilterCriteria(" + index.ToString() + ")";
            container.Attributes["onmouseover"] = this.GridID + ".highlightFilterCriteria(this)";
            container.Attributes["onmouseout"] = this.GridID + ".blurFilterCriteria(this)";
            container.Text = text;
            return container;
        }

        protected virtual void CreateFilterOptionsTemplatesContainer()
        {
            this.filterOptionsTemplatesContainer = new HtmlContainer();
            this.filterOptionsTemplatesContainer.ID = "ob_" + this.GridID + "FOTC";
            this.filterOptionsTemplatesContainer.Style["display"] = "none";
            bool flag = false;
            if (this.internalDataBinding)
            {
                foreach (Column column in this.Columns)
                {
                    if (column.FilterOptions.Count > 0)
                    {
                        column.filterOptionsTemplateContainers = null;
                        foreach (FilterOption option in column.FilterOptions)
                        {
                            if (option is CustomFilterOption)
                            {
                                CustomFilterOption option2 = option as CustomFilterOption;
                                if (!string.IsNullOrEmpty(option2.TemplateSettings.FilterTemplateId))
                                {
                                    if (!flag)
                                    {
                                        this.mainContainer.Controls.Add(this.filterOptionsTemplatesContainer);
                                        flag = true;
                                    }
                                    GridTemplate child = null;
                                    GridRuntimeTemplate runtimeTemplateById = null;
                                    HtmlContainer container = new HtmlContainer();
                                    HtmlContainer container2 = new HtmlContainer();
                                    HtmlContainer container3 = new HtmlContainer();
                                    HtmlContainer container4 = new HtmlContainer();
                                    container3.Text = option2.TemplateSettings.FilterControlsIds;
                                    container4.Text = option2.TemplateSettings.FilterControlsPropertyNames;
                                    container.Controls.Add(container2);
                                    container.Controls.Add(container3);
                                    container.Controls.Add(container4);
                                    this.filterOptionsTemplatesContainer.Controls.Add(container);
                                    if (this.Templates.GetById(option2.TemplateSettings.FilterTemplateId) is GridRuntimeTemplate)
                                    {
                                        runtimeTemplateById = this.Templates.GetRuntimeTemplateById(option2.TemplateSettings.FilterTemplateId);
                                        if (runtimeTemplateById == null)
                                        {
                                            throw new InvalidTemplateIDException(option2.TemplateSettings.FilterTemplateId);
                                        }
                                        runtimeTemplateById.Container.GridClientID = this.GridID;
                                    }
                                    else
                                    {
                                        child = this.Templates.GetById(option2.TemplateSettings.FilterTemplateId);
                                        if (child == null)
                                        {
                                            throw new InvalidTemplateIDException(option2.TemplateSettings.FilterTemplateId);
                                        }
                                        child.Container.GridClientID = this.GridID;
                                    }
                                    if (child != null)
                                    {
                                        container.ID = child.ClientID + "_" + column.Index.ToString();
                                        container2.Controls.Add(child);
                                        child.DataBind();
                                        this.StoreFilterOptionsTemplatesReferences(container, child, column.Index, option2.GetID());
                                    }
                                    if (runtimeTemplateById != null)
                                    {
                                        container.ID = runtimeTemplateById.ClientID + "_" + column.Index.ToString();
                                        try
                                        {
                                            runtimeTemplateById.DataBind();
                                        }
                                        catch (Exception exception1)
                                        {
                                            if (exception1 != null)
                                            {
                                            }
                                        }
                                        container2.Controls.Add(runtimeTemplateById);
                                        this.StoreFilterOptionsTemplatesReferences(container, runtimeTemplateById, column.Index, option2.GetID());
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        protected virtual GridRenderContainer CreateFooterContainer()
        {
            return new GridRenderContainer { ID = this.CreateFooterContainerID(), CssClass = "ob_gFCont" };
        }

        protected virtual string CreateFooterContainerID()
        {
            return ("ob_" + this.GridID + "FooterContainer");
        }

        protected void CreateFooterCorners()
        {
            this.footerCornersContainer = new HtmlContainer();
            HtmlContainer child = new HtmlContainer();
            HtmlContainer container2 = new HtmlContainer();
            this.footerCornersContainer.ID = "ob_" + this.GridID + "FCnC";
            this.footerCornersContainer.CssClass = "ob_gFCnC";
            child.CssClass = "ob_gFCnL";
            container2.CssClass = "ob_gFCnR";
            if (this.IsDesignTimeRender && this.UseEmbeddedImages)
            {
                this.footerCornersContainer.Style["background-image"] = "url(" + this.ImagesURL.FooterCornerMiddle + ")";
                child.Style["background-image"] = "url(" + this.ImagesURL.FooterCornerLeft + ")";
                container2.Style["background-image"] = "url(" + this.ImagesURL.FooterCornerRight + ")";
            }
            this.footerCornersContainer.Controls.Add(child);
            this.footerCornersContainer.Controls.Add(container2);
            this.mainContainer.Controls.Add(this.footerCornersContainer);
        }

        protected virtual void CreateFooterCornersContainer()
        {
            GridRenderContainer child = new GridRenderContainer();
            this.secondMainContainer.Controls.Add(child);
            Table table = new Table();
            table.Attributes["cellspacing"] = "0";
            table.Attributes["cellpadding"] = "0";
            TableRow row = new TableRow();
            TableCell cell = new TableCell {
                CssClass = "ob_gFCnL"
            };
            TableCell cell2 = new TableCell {
                CssClass = "ob_gFCnM",
                Text = "&#160;"
            };
            TableCell cell3 = new TableCell {
                CssClass = "ob_gFCnR"
            };
            if (this.IsDesignTimeRender && this.UseEmbeddedImages)
            {
                cell.Style["background-image"] = "url(" + this.ImagesURL.FooterCornerLeft + ")";
                cell2.Style["background-image"] = "url(" + this.ImagesURL.FooterCornerMiddle + ")";
                cell3.Style["background-image"] = "url(" + this.ImagesURL.FooterCornerRight + ")";
            }
            row.Controls.Add(cell);
            row.Controls.Add(cell2);
            row.Controls.Add(cell3);
            table.Controls.Add(row);
            child.Controls.Add(table);
            child.ID = "ob_" + this.GridID + "FCnC";
            child.CssClass = "ob_gFCnC";
        }

        protected virtual Table CreateFooterTable()
        {
            Table table = new Table();
            table.Attributes["cellpadding"] = "0";
            table.Attributes["cellspacing"] = "0";
            if (this.ScrollingSettings.ScrollWidth != 0)
            {
                table.Attributes["width"] = this.ScrollingSettings.ScrollWidth.ToString();
            }
            else if (this.Width.ToString() != string.Empty)
            {
                table.Attributes["width"] = (this.Width.ToString().IndexOf("%") == -1) ? this.Width.ToString() : "100%";
            }
            table.CssClass = this.CssSettings.CSSFooter;
            return table;
        }

        private Literal CreateGridInformationMessage()
        {
            return new Literal { Text = "<!-- Grid with id " + this.GridID + " -->" };
        }

        private string CreateGridScript()
        {
            return this.CreateGridScript(false);
        }

        private string CreateGridScript(bool renderShortVersion)
        {
            StringBuilder builder = new StringBuilder();
            if (!renderShortVersion)
            {
                builder.Append("var " + this.GridID + ";");
                builder.Append("function initGrid__" + this.GridID + "(attempts){ ");
                builder.Append("if(typeof(vdcGridJSLoaded) == \"undefined\" || typeof(vdcGrid) == \"undefined\") {if(attempts<30){window.setTimeout(\"initGrid__" + this.GridID + "(\" + (attempts+1) + \")\", 500);}else{alert(\"" + this.LocalizationSettings.JSWarning.Replace("[GRID_ID]", this.GridID).Replace("[WARNING]", "The client-side scripts cannot be loaded.") + "\");}return;}");
                builder.Append("try{");
            }
            builder.Append(this.GridID + " = new vdcGrid(\"" + this.GridID + "\",");
            builder.Append("\"" + this.UniqueID + "\",");
            builder.Append(this.CallbackMode.ToString().ToLower() + ",");
            builder.Append(this.IsPostBack.ToString().ToLower() + ",");
            builder.Append(this.Serialize.ToString().ToLower() + ",");
            builder.Append(this.AutoGenerateColumns.ToString().ToLower() + ",");
            builder.Append("\"" + (!string.IsNullOrEmpty(this.FolderStyle) ? this.CSSPath : "") + "\",");
            builder.Append("\"" + this.ImagesPath + "\",");
            builder.Append("[" + this.CreateColumnsCollectionClientSideCode() + "],");
            builder.Append(this.IndexOfFirstVisibleColumn.ToString() + ",");
            builder.Append(this.IndexOfLastVisibleColumn.ToString() + ",");
            builder.Append(this.ShowHeader.ToString().ToLower() + ",");
            builder.Append(this.ShowFooter.ToString().ToLower() + ",");
            builder.Append(this.AllowPageSizeSelection.ToString().ToLower() + ",");
            builder.Append(this.AllowPaging.ToString().ToLower() + ",");
            builder.Append(this.PageSize.ToString() + ",");
            builder.Append(this.CurrentPageIndex.ToString() + ",");
            builder.Append(this.TotalRecords.ToString() + ",");
            builder.Append(this.Cols.Count + ",");
            builder.Append(this.AllowSorting.ToString().ToLower() + ",");
            builder.Append(this.AllowColumnResizing.ToString().ToLower() + ",");
            builder.Append(this.AllowColumnReordering.ToString().ToLower() + ",");
            builder.Append("\"ob_" + this.GridID + "GridContainer\",");
            builder.Append("\"" + this.CommandVariableSeparator + "\",");
            builder.Append("\"" + this.CommandNameValueSeparator + "\",");
            builder.Append("\"" + this.ArrayElementsSeparator + "\",");
            builder.Append("\"" + this.ObjectPropertiesSeparator + "\",");
            builder.Append("\"" + this.CommandsSeparator + "\",");
            builder.Append(this.ClientSideEvents.ExposeSender.ToString().ToLower() + ",");
            builder.Append(((this.ClientSideEvents.OnBeforeClientSelect != string.Empty) ? this.ClientSideEvents.OnBeforeClientSelect : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnBeforeClientAdd != string.Empty) ? this.ClientSideEvents.OnBeforeClientAdd : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnBeforeClientInsert != string.Empty) ? this.ClientSideEvents.OnBeforeClientInsert : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnBeforeClientEdit != string.Empty) ? this.ClientSideEvents.OnBeforeClientEdit : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnBeforeClientUpdate != string.Empty) ? this.ClientSideEvents.OnBeforeClientUpdate : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnBeforeClientDelete != string.Empty) ? this.ClientSideEvents.OnBeforeClientDelete : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientSelect != string.Empty) ? this.ClientSideEvents.OnClientSelect : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientAdd != string.Empty) ? this.ClientSideEvents.OnClientAdd : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientInsert != string.Empty) ? this.ClientSideEvents.OnClientInsert : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientEdit != string.Empty) ? this.ClientSideEvents.OnClientEdit : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientUpdate != string.Empty) ? this.ClientSideEvents.OnClientUpdate : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientDelete != string.Empty) ? this.ClientSideEvents.OnClientDelete : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnBeforeClientCancelEdit != string.Empty) ? this.ClientSideEvents.OnBeforeClientCancelEdit : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientCancelEdit != string.Empty) ? this.ClientSideEvents.OnClientCancelEdit : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnBeforeClientCancelAdd != string.Empty) ? this.ClientSideEvents.OnBeforeClientCancelAdd : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientCancelAdd != string.Empty) ? this.ClientSideEvents.OnClientCancelAdd : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientPopulateControls != string.Empty) ? this.ClientSideEvents.OnClientPopulateControls : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientCallback != string.Empty) ? this.ClientSideEvents.OnClientCallback : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientCallbackError != string.Empty) ? this.ClientSideEvents.OnClientCallbackError : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientExportStart != string.Empty) ? this.ClientSideEvents.OnClientExportStart : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnClientExportFinish != string.Empty) ? this.ClientSideEvents.OnClientExportFinish : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnFiltering != string.Empty) ? this.ClientSideEvents.OnFiltering : "\"\"") + ",");
            builder.Append(((this.ClientSideEvents.OnPopulatingFilterFields != string.Empty) ? this.ClientSideEvents.OnPopulatingFilterFields : "\"\"") + ",");
            builder.Append(this.AllowAddingRecords.ToString().ToLower() + ",");
            builder.Append(this.AllowMultiRecordAdding.ToString().ToLower() + ",");
            builder.Append(this.AllowMultiRecordEditing.ToString().ToLower() + ",");
            builder.Append(this.AllowMultiRecordDeleting.ToString().ToLower() + ",");
            builder.Append(((int) this.AddEditDeleteSettings.NewRecordPosition).ToString() + ",");
            builder.Append("\"" + this._templateSettings.NewRecord_TemplateId + "\",");
            builder.Append("\"" + this._templateSettings.NewRecord_EditTemplateId + "\",");
            builder.Append(this.AllowRecordSelection.ToString().ToLower() + ",");
            builder.Append(this.AllowMultiRecordSelection.ToString().ToLower() + ",");
            builder.Append(this.KeepSelectedRecords.ToString().ToLower() + ",");
            builder.Append(this.AutoPostBackOnSelect.ToString().ToLower() + ",");
            builder.Append(this.ShowTooltipOnResize.ToString().ToLower() + ",");
            builder.Append(this.EnableTypeValidation.ToString().ToLower() + ",");
            builder.Append("\"" + this.CssSettings.CSSHeader + "\",");
            builder.Append("\"" + this.CssSettings.CSSBodyHeader + "\",");
            builder.Append("\"" + this.CssSettings.CSSRecordGroupHeader + "\",");
            builder.Append("\"" + this.CssSettings.CSSRecordGroupFooter + "\",");
            builder.Append("\"" + this.CssSettings.CSSRecord + "\",");
            builder.Append("\"" + this.CssSettings.CSSRecordAlternate + "\",");
            builder.Append("\"" + this.CssSettings.CSSRecordSelected + "\",");
            builder.Append("\"" + this.CssSettings.CSSRecordHover + "\",");
            builder.Append("\"" + this.CssSettings.CSSCellPadding + "\",");
            builder.Append("\"" + this.CssSettings.CSSCell + "\",");
            builder.Append("\"" + this.CssSettings.CSSFirstCell + "\",");
            builder.Append("\"" + this.CssSettings.CSSResizableContent + "\",");
            builder.Append("\"" + this.CssSettings.CSSResizableContentWithWrap + "\",");
            builder.Append("\"" + this.CssSettings.CSSSelectionArea + "\",");
            builder.Append("\"" + this.CssSettings.CSSActionLink + "\",");
            builder.Append("\"" + this.CssSettings.CSSEditControl + "\",");
            builder.Append("\"" + this.CssSettings.CSSLoadingMessage + "\",");
            builder.Append("\"" + this.CssSettings.CSSResizeLines + "\",");
            builder.Append("\"" + this.CssSettings.CSSData + "\",");
            builder.Append("\"" + this.CssSettings.CSSRowEditTemplate + "\",");
            builder.Append("\"" + this.CssSettings.CSSCellTemporaryAdded + "\",");
            builder.Append("\"" + this.CssSettings.CSSCellTemporaryEdited + "\",");
            builder.Append("\"" + this.CssSettings.CSSCellTemporaryDeleted + "\",");
            builder.Append("\"" + this.CssSettings.CSSBodyFooter + "\",");
            builder.Append("\"" + this.CssSettings.CSSActionLinkFooter + "\",");
            builder.Append("\"" + this.CssSettings.CSSNavigationLink + "\",");
            builder.Append("\"" + this.CssSettings.CSSNavigationLinkHover + "\",");
            builder.Append("\"" + this.CssSettings.CSSFilterCriteria + "\",");
            builder.Append("\"" + this.CssSettings.CSSFilterCriteriaHover + "\",");
            builder.Append("\"" + this.CssSettings.CSSResizingTooltip + "\",");
            builder.Append("\"" + this.CssSettings.CSSNoRecordsMessage + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaDefaultColumn + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaColumn + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaColumnLeft + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaColumnContent + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaColumnRight + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaColumnSpacer + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupDraggingColumn + "\",");
            builder.Append("\"" + this.CssSettings.CSSHeaderColumnHighlightedWhenGrouping + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaColumnHighlightedWhenDragging + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaTopArrow + "\",");
            builder.Append("\"" + this.CssSettings.CSSGroupingAreaBottomArrow + "\",");
            builder.Append("\"" + this.CssSettings.CSSDetailGridContainer + "\",");
            builder.Append("\"" + this.CssSettings.CSSDetailGridLeftSpacer + "\",");
            builder.Append("\"" + this.RecordInEditMode.ToString() + "\",");
            builder.Append(this.RecordInAddMode.ToString().ToLower() + ",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Paging_PageSizeText) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Paging_RecordsText) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Paging_ToText) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Paging_OfText) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Paging_PagesText) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.AddLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.EditLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.DeleteLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.UpdateLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.CancelLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.SaveLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.SaveAllLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.CancelAllLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.RemoveLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.ModifyLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.UndeleteLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.LoadingText) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.NoRecordsText) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.ResizingTooltipWidth) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.ResizingTooltipPixels) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.TypeValidationError) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.MaxLengthValidationError) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Filter_ShowLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Filter_HideLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Filter_ApplyLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Filter_RemoveLink) + "\",");
            builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(this.LocalizationSettings.Grouping_GroupingAreaText) + "\",");
            builder.Append("\"" + this.Width.ToString() + "\", ");
            builder.Append("\"" + this.Height.ToString() + "\", ");
            builder.Append("\"" + this.ScrollingSettings.ScrollHeight.ToString() + "\", ");
            builder.Append("\"" + this.ScrollingSettings.ScrollWidth.ToString() + "\", ");
            builder.Append(this.ScrollingSettings.ScrollTop.ToString() + ", ");
            builder.Append(this.ScrollingSettings.ScrollLeft.ToString() + ", ");
            builder.Append(this.ScrollingSettings.NumberOfFixedColumns.ToString() + ", ");
            builder.Append(((int) this.ScrollingSettings.FixedColumnsPosition).ToString() + ", ");
            builder.Append(this.ScrollingSettings.EnableVirtualScrolling.ToString().ToLower() + ", ");
            builder.Append(this.ScrollingSettings.UsePagingForVirtualScrolling.ToString().ToLower() + ", ");
            builder.Append(this.GenerateRecordIds.ToString().ToLower() + ",");
            builder.Append(this.EnableRecordHover.ToString().ToLower() + ",");
            builder.Append(this.AllowFiltering.ToString().ToLower() + ",");
            builder.Append(((int) this.FilteringSettings.FilterPosition).ToString() + ", ");
            builder.Append("\"" + this.FilteringButtonsConfigurationValue.ToString() + "\",");
            builder.Append("\"" + this._templateSettings.FilterShowButton_TemplateId + "\",");
            builder.Append("\"" + this._templateSettings.FilterApplyButton_TemplateId + "\",");
            builder.Append("\"" + this._templateSettings.FilterHideButton_TemplateId + "\",");
            builder.Append("\"" + this._templateSettings.FilterRemoveButton_TemplateId + "\",");
            builder.Append("\"" + this.FilterType.ToString() + "\",");
            builder.Append(this.ShowLoadingMessage.ToString().ToLower() + ",");
            builder.Append(this.AllowKeyNavigation.ToString().ToLower() + ",");
            builder.Append(this.AllowGrouping.ToString().ToLower() + ",");
            builder.Append(this.GroupingSettings.AllowChanges.ToString().ToLower() + ", ");
            builder.Append("\"" + this._templateSettings.RowEditTemplateId + "\",");
            try
            {
                builder.Append("\"" + GridEncodingHelper.XMLCdataEncode(Path.GetFileName(HttpContext.Current.Request.FilePath)) + "\",");
            }
            catch (Exception exception1)
            {
                if (exception1 != null)
                {
                }
                builder.Append("\"\",");
            }
            builder.Append(this.ShowColumnsFooter.ToString().ToLower() + ",");
            builder.Append(this.ShowGroupFooter.ToString().ToLower() + ",");
            builder.Append(this.HideColumnsWhenGrouping.ToString().ToLower() + ",");
            bool flag34 = this.DetailGrids.Count > 0;
            builder.Append(flag34.ToString().ToLower() + ",");
            builder.Append("'" + this.MasterDetailSettings.LoadingMode.ToString() + "',");
            builder.Append(this.MasterDetailSettings.ShowEmptyDetails.ToString().ToLower() + ",");
            builder.Append(((this is DetailGrid) ? (this as DetailGrid).MasterGrid.MasterDetailSettings.ShowEmptyDetails.ToString().ToLower() : "false") + ",");
            builder.Append("'" + ((this is DetailGrid) ? ((DetailGrid) this).MasterGrid.ID : "") + "',");
            builder.Append(this.GetForeignKeysValues() + ",");
            builder.Append("'" + this.ExportingSettings.ExportedFilesTargetWindow + "',");
            builder.Append(renderShortVersion.ToString().ToLower() + ",");
            builder.Append(this.ImagesURL.SerializeToJSON());
            builder.Append(");");
            if (!renderShortVersion)
            {
                builder.Append("}catch(e){alert(\"" + this.LocalizationSettings.JSWarning.Replace("[GRID_ID]", this.GridID) + "\".replace(\"[WARNING]\", e.message));}}");
                builder.Append(" initGrid__" + this.GridID + "(0); ");
            }
            if (this.enableUnitTests)
            {
                builder.Append("function exposeTestFunctionNames() {return vdcGrid_UnitTestManager.UnitTests;};");
            }
            return builder.ToString();
        }

        protected virtual GridRenderContainer CreateGroupingAreaContainer()
        {
            return new GridRenderContainer { ID = this.CreateGroupingAreaContainerID(), CssClass = this.CssSettings.CSSGroupingAreaContainer };
        }

        protected virtual string CreateGroupingAreaContainerID()
        {
            return ("ob_" + this.GridID + "GroupingAreaContainer");
        }

        protected virtual Table CreateGroupingAreaTable()
        {
            Table table = new Table();
            table.Attributes["cellpadding"] = "0";
            table.Attributes["cellspacing"] = "0";
            table.Attributes["width"] = "100%";
            return table;
        }

        protected virtual GridRenderContainer CreateHeaderContainer()
        {
            GridRenderContainer container = new GridRenderContainer();
            if (this.ShowHeader)
            {
                container.ID = this.CreateHeaderContainerID();
                container.CssClass = !this.AllowGrouping ? this.CssSettings.CSSHeaderContainerWithoutGrouping : this.CssSettings.CSSHeaderContainer;
                this.CreateHeaderContainerStyle(container);
            }
            return container;
        }

        protected virtual string CreateHeaderContainerID()
        {
            return ("ob_" + this.GridID + "HeaderContainer");
        }

        protected virtual void CreateHeaderContainerStyle(GridRenderContainer container)
        {
            if ((this.ScrollingSettings.ScrollWidth != 0) || this.IsDesignTimeRender)
            {
                if (this.ScrollingSettings.ScrollWidth != 0)
                {
                    container.Style["width"] = this.ScrollingSettings.ScrollWidth.ToString() + "px;";
                }
                if (this.IsDesignTimeRender && this.UseEmbeddedImages)
                {
                    container.Style["background-image"] = "url(" + this.ImagesURL.Header_Placeholder + ");";
                }
            }
        }

        protected void CreateHeaderCorners()
        {
            this.headerCornersContainer = new HtmlContainer();
            HtmlContainer child = new HtmlContainer();
            HtmlContainer container2 = new HtmlContainer();
            this.headerCornersContainer.ID = "ob_" + this.GridID + "HCnC";
            this.headerCornersContainer.CssClass = "ob_gHCnC";
            child.CssClass = "ob_gHCnL";
            container2.CssClass = "ob_gHCnR";
            if (this.IsDesignTimeRender && this.UseEmbeddedImages)
            {
                this.headerCornersContainer.Style["background-image"] = "url(" + this.ImagesURL.HeaderCornerMiddle + ")";
                child.Style["background-image"] = "url(" + this.ImagesURL.HeaderCornerLeft + ")";
                container2.Style["background-image"] = "url(" + this.ImagesURL.HeaderCornerRight + ")";
            }
            this.headerCornersContainer.Controls.Add(child);
            this.headerCornersContainer.Controls.Add(container2);
            this.mainContainer.Controls.Add(this.headerCornersContainer);
        }

        protected virtual Table CreateHeaderTable()
        {
            Table table = new Table();
            table.Attributes["cellpadding"] = "0";
            table.Attributes["cellspacing"] = "0";
            if (this.Width.ToString() != string.Empty)
            {
                table.Attributes["width"] = (this.Width.ToString().IndexOf("%") == -1) ? this.Width.ToString() : "100%";
            }
            if (this.IsDesignTimeRender && this.UseEmbeddedImages)
            {
                if (this.AllowGrouping)
                {
                    table.Style["background-image"] = "url(" + this.ImagesURL.Header + ")";
                }
                else
                {
                    table.Style["background-image"] = "url(" + this.ImagesURL.HeaderWithoutGrouping + ")";
                }
            }
            table.CssClass = this.CssSettings.CSSHeader;
            return table;
        }

        protected virtual string CreateHeaderTableID()
        {
            return ("ob_" + this.GridID + "Header");
        }

        protected virtual void CreateHiddenContainers()
        {
            if (!this.emptyDetailGridRemoved)
            {
                this.CreateEditTemplatesContainer();
            }
            this.CreateViewStateContainer();
            this.CreateSelectedRecordsContainer();
            this.CreateSelectedRecordsIndexesContainer();
            this.CreateCommandsParametersContainer();
            this.CreateCallbackErrorContainer();
            this.CreateExpandedMasterRowsContainer();
            this.CreatePageSelector();
            this.CreateTotalNumberOfRecordsContainer();
            if ((this is DetailGrid) && ((DetailGrid) this).MasterGrid.IsInCallbackHierarchy())
            {
                this.CreateJSScriptContainerForDetailGrid();
            }
            if (!this.CallbackMode || !this.IsCallback)
            {
                this.CreateRowEditTemplateContainer();
                this.CreateFilterOptionsTemplatesContainer();
                this.CreateCellDivsWidthContainer();
                this.CreateColumnsWidthContainer();
                this.CreateNewRecordEditTemplateContainer();
                this.CreateColumnsVisibleStateContainer();
                this.CreateFilterButtonsConfigurationContainer();
                this.CreateClientFilterExpressionContainer();
                this.CreateFilterButtonsTemplatesContainer();
                this.CreateMultiRecordTemplateSettingsContainer();
                this.CreateSerializedColumnsContainer();
                this.CreateSortExpressionContainer();
            }
            this.CreateElementsClientIdsContainer();
            if (!this.CallbackMode || this.AutoPostBackOnSelect)
            {
                this.CreatePostbackElementContainer();
            }
        }

        protected virtual void CreateJSScriptContainerForDetailGrid()
        {
            this.scriptContainerForDetailGrid = new GridCellDivContainer();
            this.scriptContainerForDetailGrid.Style["display"] = "none";
            this.scriptContainerForDetailGrid.CssClass = "ob_gMDJsScriptContainer";
            this.mainContainer.Controls.Add(this.scriptContainerForDetailGrid);
        }

        protected virtual GridRenderContainer CreateMainContainer()
        {
            GridRenderContainer container = new GridRenderContainer {
                ID = this.CreateMainContainerID(),
                CssClass = this.CssSettings.CSSContainer
            };
            if (this.IsDesignTimeRender)
            {
                container.CssClass = container.CssClass + " ob_gMCont_DT";
            }
            container.Style["width"] = this.GetMainContainerWidth();
            Unit height = this.Height;
            if (this.Height.ToString() != "0px")
            {
                container.Style["height"] = this.Height.ToString();
                return container;
            }
            if (this.ScrollingSettings.ScrollHeight.ToString().IndexOf("%") != -1)
            {
                container.Style["max-height"] = this.ScrollingSettings.ScrollHeight.ToString();
            }
            return container;
        }

        protected virtual string CreateMainContainerID()
        {
            return ("ob_" + this.GridID + "MainContainer");
        }

        protected virtual void CreateMultiRecordTemplateSettingsContainer()
        {
            if ((this.AllowMultiRecordAdding || this.AllowMultiRecordEditing) || this.AllowMultiRecordDeleting)
            {
                this.multiRecordTemplateSettingsContainer = new GridRenderContainer();
                this.multiRecordTemplateSettingsContainer.ID = "ob_" + this.GridID + "CMRTS";
                this.multiRecordTemplateSettingsContainer.Style["display"] = "none";
                int num = 0;
                foreach (Column column in this.Columns)
                {
                    if (column.AllowEdit || column.AllowDelete)
                    {
                        GridRenderContainer child = new GridRenderContainer {
                            ID = "ob_" + this.GridID + "CMRTS_" + num.ToString()
                        };
                        GridRenderContainer container2 = new GridRenderContainer();
                        if (!string.IsNullOrEmpty(column.TemplateSettings.ModifyTemporaryEditedRecord_TemplateId))
                        {
                            GridTemplate template = this.CreateTemplate(column.TemplateSettings.ModifyTemporaryEditedRecord_TemplateId, "", null, null, 0, 0);
                            container2.Controls.Add(template);
                        }
                        child.Controls.Add(container2);
                        GridRenderContainer container3 = new GridRenderContainer();
                        if (!string.IsNullOrEmpty(column.TemplateSettings.CancelTemporaryEditedRecord_TemplateId))
                        {
                            GridTemplate template2 = this.CreateTemplate(column.TemplateSettings.CancelTemporaryEditedRecord_TemplateId, "", null, null, 0, 0);
                            container3.Controls.Add(template2);
                        }
                        child.Controls.Add(container3);
                        GridRenderContainer container4 = new GridRenderContainer();
                        if (!string.IsNullOrEmpty(column.TemplateSettings.ModifyTemporaryAddedRecord_TemplateId))
                        {
                            GridTemplate template3 = this.CreateTemplate(column.TemplateSettings.ModifyTemporaryAddedRecord_TemplateId, "", null, null, 0, 0);
                            container4.Controls.Add(template3);
                        }
                        child.Controls.Add(container4);
                        GridRenderContainer container5 = new GridRenderContainer();
                        if (!string.IsNullOrEmpty(column.TemplateSettings.CancelTemporaryAddedRecord_TemplateId))
                        {
                            GridTemplate template4 = this.CreateTemplate(column.TemplateSettings.CancelTemporaryAddedRecord_TemplateId, "", null, null, 0, 0);
                            container5.Controls.Add(template4);
                        }
                        child.Controls.Add(container5);
                        GridRenderContainer container6 = new GridRenderContainer();
                        if (!string.IsNullOrEmpty(column.TemplateSettings.RemoveTemporaryAddedRecord_TemplateId))
                        {
                            GridTemplate template5 = this.CreateTemplate(column.TemplateSettings.RemoveTemporaryAddedRecord_TemplateId, "", null, null, 0, 0);
                            container6.Controls.Add(template5);
                        }
                        child.Controls.Add(container6);
                        GridRenderContainer container7 = new GridRenderContainer();
                        if (!string.IsNullOrEmpty(column.TemplateSettings.UndeleteTemporaryDeletedRecord_TemplateId))
                        {
                            GridTemplate template6 = this.CreateTemplate(column.TemplateSettings.UndeleteTemporaryDeletedRecord_TemplateId, "", null, null, 0, 0);
                            container7.Controls.Add(template6);
                        }
                        child.Controls.Add(container7);
                        this.multiRecordTemplateSettingsContainer.Controls.Add(child);
                    }
                    num++;
                }
                this.mainContainer.Controls.Add(this.multiRecordTemplateSettingsContainer);
                this.multiRecordTemplateSettingsContainer.DataBind();
            }
        }

        protected virtual void CreateNewRecordEditTemplateContainer()
        {
            if (!string.IsNullOrEmpty(this.TemplateSettings.NewRecord_EditTemplateId))
            {
                if ((this.AddEditDeleteSettings.AddLinksPosition == GridElementPosition.Top) || (this.AddEditDeleteSettings.AddLinksPosition == GridElementPosition.TopAndBottom))
                {
                    this.topNewRecordEditTemplateContainer = new GridRenderContainer();
                    this.topNewRecordEditTemplateContainer.ID = "ob_" + this.GridID + "NRETC_T";
                    this.topNewRecordEditTemplateContainer.Style["display"] = "none";
                    GridCellSpanContainer child = new GridCellSpanContainer();
                    this.topNewRecordEditTemplateContainer.Controls.Add(child);
                    GridTemplate template = this.CreateTemplate(this.TemplateSettings.NewRecord_EditTemplateId, "2", null, null, 0, 0, true);
                    child.Controls.Add(template);
                    this.mainContainer.Controls.Add(this.topNewRecordEditTemplateContainer);
                    this.topNewRecordEditTemplateContainer.DataBind();
                }
                if ((this.AddEditDeleteSettings.AddLinksPosition == GridElementPosition.Bottom) || (this.AddEditDeleteSettings.AddLinksPosition == GridElementPosition.TopAndBottom))
                {
                    this.newRecordEditTemplateContainer = new GridRenderContainer();
                    this.newRecordEditTemplateContainer.ID = "ob_" + this.GridID + "NRETC";
                    this.newRecordEditTemplateContainer.Style["display"] = "none";
                    GridCellSpanContainer container2 = new GridCellSpanContainer();
                    this.newRecordEditTemplateContainer.Controls.Add(container2);
                    GridTemplate template2 = this.CreateTemplate(this.TemplateSettings.NewRecord_EditTemplateId, "1", null, null, 0, 0, true);
                    container2.Controls.Add(template2);
                    this.mainContainer.Controls.Add(this.newRecordEditTemplateContainer);
                    this.newRecordEditTemplateContainer.DataBind();
                }
            }
        }

        private void CreatePagedDataSource()
        {
            this.pagedDataSource = new PagedDataSource();
            if (this.IsDesignTimeRender)
            {
                this.internalDataSource = this.CreateDesignTimeDataSource(this.internalDataSource);
            }
            if (this.internalDataBinding)
            {
                if (this.internalDataSource is IDataReader)
                {
                    this.internalDataSource = this.ConvertIDataReaderToIEnumerable(this.internalDataSource as IDataReader);
                }
                else if (((this.internalDataSource != null) && !(this.internalDataSource is DataView)) && (this.internalDataSource is ICollection))
                {
                    this.internalDataSource = this.ConvertICollectionToDataView(this.internalDataSource as ICollection);
                }
            }
            if (!this.internalDataBinding)
            {
                this.pagedDataSource.DataSource = this.internalDataSource;
                if (this.AllowGrouping && ((!this.groupingExpressionHandled || !this.Serialize) || this.AutoGenerateColumns))
                {
                    this.ManageGroupBy();
                }
            }
            else
            {
                if (this.Serialize && (this.internalDataSource != null))
                {
                    this.SerializeDataSource(this.internalDataSource);
                }
                this.pagedDataSource.DataSource = this.internalDataSource;
                this.CreateDataControlFields();
                this.GetColumnTypes();
                if (this.AllowGrouping && ((!this.groupingExpressionHandled || !this.Serialize) || this.AutoGenerateColumns))
                {
                    this.ManageGroupBy();
                }
                this.SetFilterExpression(true, true);
                if (!this.GetData().CanSort || this.clearDataSourceSelectArgumentsSortExpression)
                {
                    this.dataSourceSortExpression = this.GetSortExpression();
                }
                if ((!string.IsNullOrEmpty(this.FilterExpression) && this.handleDataSourceFiltering) || (!string.IsNullOrEmpty(this.dataSourceSortExpression) && this.handleDataSourceSorting))
                {
                    try
                    {
                        this.pagedDataSource.DataSource = this.ApplyCriteriasToDataSource(this.internalDataSource);
                    }
                    catch (Exception exception1)
                    {
                        if (exception1 != null)
                        {
                        }
                        this.pagedDataSource.DataSource = this.internalDataSource;
                    }
                }
                else
                {
                    this.pagedDataSource.DataSource = this.internalDataSource;
                }
            }
            if (this.handleDataSourceCount || (this.TotalRecords == 0))
            {
                bool flag = false;
                if (this.internalDataBinding)
                {
                    DataSourceView data = this.GetData();
                    if (data.CanPage)
                    {
                        this.pagedDataSource.AllowServerPaging = true;
                        if (data.CanRetrieveTotalRowCount)
                        {
                            this.pagedDataSource.VirtualCount = base.SelectArguments.TotalRowCount;
                            this.TotalRecords = this.pagedDataSource.VirtualCount;
                            flag = true;
                        }
                    }
                }
                if (!flag)
                {
                    this.TotalRecords = this.pagedDataSource.DataSourceCount;
                }
            }
            this.ManageCurrentPageIndex();
            if (this.handleDataSourcePaging)
            {
                this.pagedDataSource.AllowPaging = true;
                this.pagedDataSource.PageSize = this.GetPageSize(true);
                this.pagedDataSource.CurrentPageIndex = this.CurrentPageIndex;
            }
            if (!this.ScrollingSettings.EnableVirtualScrolling || this.ScrollingSettings.UsePagingForVirtualScrolling)
            {
                this.StartRowIndex = (this.CurrentPageIndex * this.GetPageSize(true)) + 1;
            }
            else
            {
                this.StartRowIndex = 1;
            }
        }

        protected virtual void CreatePageSelector()
        {
            this.PageSelector = new GridHtmlInputHidden();
            this.PageSelector.ID = this.GetPageSelectorID();
            this.PageSelector.Value = this.CurrentPageIndex.ToString();
            this.mainContainer.Controls.Add(this.PageSelector);
        }

        protected virtual void CreatePostbackElementContainer()
        {
            GridRenderContainer child = new GridRenderContainer();
            child.Style["display"] = "none";
            this.postbackElement = new Button();
            this.postbackElement.ID = "ob_" + this.GridID + "PE";
            child.Controls.Add(this.postbackElement);
            this.mainContainer.Controls.Add(child);
        }

        protected virtual void CreateReferencesForAppearanceResources()
        {
            if (this.IsDesignTimeRender || !HttpContext.Current.Items.Contains("vdcGrid_StyleSheetAdded"))
            {
                if (!this.CallbackMode || !this.IsCallback)
                {
                    this.GetStyleSheetPath();
                    if (((this.Page != null) && (this.Page.Header != null)) && ((this.CSSPath != null) && !(this is DetailGrid)))
                    {
                        HtmlLink item = new HtmlLink();
                        item.Attributes.Add("type", "text/css");
                        item.Attributes.Add("rel", "stylesheet");
                        item.Href = this.CSSPath;
                        if (!this.emptyDataBindingExecuted && ((this.IsDesignTimeRender || !this.MyScriptManager.isAjax) || !this.MyScriptManager.IsInAsyncPostBack()))
                        {
                            if (this.htmlLinksAddedToHead == null)
                            {
                                this.htmlLinksAddedToHead = new List<HtmlLink>();
                            }
                            else if (this.htmlLinksAddedToHead.Count > 0)
                            {
                                foreach (HtmlLink link2 in this.htmlLinksAddedToHead)
                                {
                                    this.Page.Header.Controls.Remove(link2);
                                }
                                this.htmlLinksAddedToHead = new List<HtmlLink>();
                            }
                            this.htmlLinksAddedToHead.Add(item);
                            this.Page.Header.Controls.Add(item);
                            this.AddStyleSheetReferenceForInterfaceControl(this.GetInterfaceFolderStyle_DropDownList(), typeof(VdcDropDownList), VdcDropDownList.GetLinkToEmbeddedStyleSheet(), true);
                            this.AddStyleSheetReferenceForInterfaceControl(this.GetInterfaceFolderStyle_TextBox(), typeof(VdcTextBox), VdcTextBox.GetLinkToEmbeddedStyleSheet(), true);
                        }
                        else
                        {
                            if ((this.IsDesignTimeRender || !this.MyScriptManager.isAjax) || !this.MyScriptManager.IsInAsyncPostBack())
                            {
                                this.Controls.Add(item);
                            }
                            else
                            {
                                this.MyScriptManager.RegisterClientScriptBlock("vdcGridStyleSheet", Vdc.Grid.JSHelper.AddStyleSheet(this.CSSPath, this.ID), true);
                            }
                            this.AddStyleSheetReferenceForInterfaceControl(this.GetInterfaceFolderStyle_DropDownList(), typeof(VdcDropDownList), VdcDropDownList.GetLinkToEmbeddedStyleSheet(), false);
                            this.AddStyleSheetReferenceForInterfaceControl(this.GetInterfaceFolderStyle_TextBox(), typeof(VdcTextBox), VdcTextBox.GetLinkToEmbeddedStyleSheet(), false);
                        }
                    }
                }
                if (((this.Page == null) || ((this.Page.Header == null) && (this.CSSPath != null))) && !(this is DetailGrid))
                {
                    if (this.IsDesignTimeRender)
                    {
                        this.GetStyleSheetPath();
                    }
                    if ((this.IsDesignTimeRender || !this.MyScriptManager.isAjax) || !this.MyScriptManager.IsInAsyncPostBack())
                    {
                        HtmlLink child = new HtmlLink();
                        child.Attributes.Add("type", "text/css");
                        child.Attributes.Add("rel", "stylesheet");
                        child.Attributes.Add("display", "all");
                        child.Href = this.CSSPath;
                        this.Controls.Add(child);
                    }
                    else
                    {
                        this.MyScriptManager.RegisterClientScriptBlock("vdcGridStyleSheet", Vdc.Grid.JSHelper.AddStyleSheet(this.CSSPath, this.ID), true);
                    }
                    this.AddStyleSheetReferenceForInterfaceControl(this.GetInterfaceFolderStyle_DropDownList(), typeof(VdcDropDownList), VdcDropDownList.GetLinkToEmbeddedStyleSheet(), false);
                    this.AddStyleSheetReferenceForInterfaceControl(this.GetInterfaceFolderStyle_TextBox(), typeof(VdcTextBox), VdcTextBox.GetLinkToEmbeddedStyleSheet(), false);
                }
                if (((this.Page != null) && (this.Page.Header != null)) && (!this.IsDesignTimeRender && !this.Page.IsCrossPagePostBack))
                {
                    HttpContext.Current.Items.Add("vdcGrid_StyleSheetAdded", true);
                }
            }
            if (this.FolderStyle != string.Empty)
            {
                this.ImagesPath = this.FolderStyle.Replace(@"\", "/");
                if (this.ImagesPath.IndexOf("~") == 0)
                {
                    this.ImagesPath = base.ResolveUrl(this.ImagesPath);
                }
            }
            if (this.CssSettings.CSSFolderImages != string.Empty)
            {
                this.ImagesPath = this.CssSettings.CSSFolderImages.Replace(@"\", "/");
                if (this.ImagesPath.IndexOf("~") == 0)
                {
                    this.ImagesPath = base.ResolveUrl(this.ImagesPath);
                }
            }
            if ((this.ImagesPath.IndexOf("~") == 0) && this.IsDesignTimeRender)
            {
                string pathToActiveFile = GridIOHelper.GetPathToActiveFile(this);
                string relativePathToProject = GridIOHelper.GetRelativePathToProject(this, this.ImagesPath);
                try
                {
                    this.ImagesPath = GridIOHelper.EvaluateRelativePath(pathToActiveFile, relativePathToProject, "folder with images");
                }
                catch (Exception exception1)
                {
                    if (exception1 != null)
                    {
                    }
                }
            }
            this.GetImagesUrl();
        }

        protected virtual GridRow CreateRow(int rowIndex, int dataSourceIndex, GridRowType rowType, DataControlRowState rowState)
        {
            return new GridRow(rowIndex, dataSourceIndex, rowType, rowState);
        }

        protected virtual void CreateRowEditTemplateContainer()
        {
            if (!string.IsNullOrEmpty(this.TemplateSettings.RowEditTemplateId))
            {
                bool flag = false;
                if (this.Page.IsCallback)
                {
                    try
                    {
                        if (this.Page.Request.Params.Get("__ob_grid" + this.GridID + "IsCallback") != null)
                        {
                            flag = true;
                        }
                    }
                    catch
                    {
                    }
                }
                this.rowEditTemplateContainer = new GridRenderContainer();
                this.rowEditTemplateContainer.ID = "ob_" + this.GridID + "RowEditTpl";
                this.rowEditTemplateContainer.Style["display"] = "none";
                GridRenderContainer child = new GridRenderContainer {
                    CssClass = "ob_gRETpl"
                };
                this.rowEditTemplateContainer.Controls.Add(child);
                GridTemplate byId = null;
                GridRuntimeTemplate runtimeTemplateById = null;
                this.mainContainer.Controls.Add(this.rowEditTemplateContainer);
                if ((this.internalDataBinding || flag) || !this.Page.IsCallback)
                {
                    if (!(this.Templates.GetById(this.TemplateSettings.RowEditTemplateId) is GridRuntimeTemplate))
                    {
                        byId = this.Templates.GetById(this.TemplateSettings.RowEditTemplateId);
                        if (byId == null)
                        {
                            throw new InvalidTemplateIDException(this.TemplateSettings.RowEditTemplateId);
                        }
                        child.Controls.Clear();
                        child.Controls.Add(byId);
                        if (this is DetailGrid)
                        {
                            byId.EnsureChildControlsCreated();
                        }
                        this.RowEditTemplate = byId;
                    }
                    else
                    {
                        runtimeTemplateById = this.Templates.GetRuntimeTemplateById(this.TemplateSettings.RowEditTemplateId);
                        if (runtimeTemplateById == null)
                        {
                            throw new InvalidTemplateIDException(this.TemplateSettings.RowEditTemplateId);
                        }
                        child.Controls.Add(runtimeTemplateById);
                        runtimeTemplateById.DataBind();
                        this.RowEditTemplate = runtimeTemplateById;
                    }
                }
            }
        }

        protected virtual GridRenderContainer CreateSecondMainContainer()
        {
            return new GridRenderContainer { CssClass = "ob_gMContC" };
        }

        protected virtual void CreateSelectedRecordsContainer()
        {
            string str = "";
            if (this.AllowRecordSelection)
            {
                this.SelectedRecordsContainer = new HtmlInputHidden();
                this.SelectedRecordsContainer.ID = this.GetSelectedRecordsContainerID();
                if (this.KeepSelectedRecords)
                {
                    if (((!this.MultiPageSelectionLoaded && (this.SelectedRecords != null)) && (this.SelectedRecords.Count > 0)) && (string.IsNullOrEmpty(str) || (this.SelectedRecords.Count > str.Split(new char[] { ',' }).Length)))
                    {
                        this.CreateSelectedRecordsString();
                    }
                    if ((this.SelectedRecordsString != null) && ((str == null) || (str == string.Empty)))
                    {
                        this.SelectedRecordsString = this.SelectedRecordsString.Replace(this.ObjectPropertiesSeparator + "true", this.ObjectPropertiesSeparator + "false");
                    }
                    this.SelectedRecordsContainer.Value = this.SelectedRecordsString;
                }
                this.mainContainer.Controls.Add(this.SelectedRecordsContainer);
            }
        }

        protected virtual void CreateSelectedRecordsIndexesContainer()
        {
            if (this.AllowRecordSelection && this.KeepSelectedRecords)
            {
                this.SelectedRecordsIndexesContainer = new HtmlInputHidden();
                this.SelectedRecordsIndexesContainer.ID = this.GetSelectedRecordsIndexesContainerID();
                this.SelectedRecordsIndexesContainer.Value = this.selectedRowsIndexes;
                this.mainContainer.Controls.Add(this.SelectedRecordsIndexesContainer);
            }
        }

        private void CreateSelectedRecordsString()
        {
            if ((this.SelectedRecords != null) && (this.SelectedRecords.Count > 0))
            {
                string str = "";
                int num = 0;
                foreach (Hashtable hashtable in this.SelectedRecords)
                {
                    if (!this.CheckPageRecord(hashtable))
                    {
                        string str2 = "";
                        int num2 = 0;
                        foreach (DictionaryEntry entry in hashtable)
                        {
                            if (str2 != string.Empty)
                            {
                                str2 = str2 + this.CommandVariableSeparator;
                            }
                            str2 = str2 + GridEncodingHelper.XMLCdataEncode(entry.Key.ToString()) + this.CommandNameValueSeparator + GridEncodingHelper.XMLCdataEncode(entry.Value.ToString()).Replace("\r\n", "<BR>").Replace("%", "%25");
                            num2++;
                        }
                        if (str != string.Empty)
                        {
                            str = str + this.ArrayElementsSeparator;
                        }
                        str = str + str2;
                        num++;
                    }
                }
                this.SelectedRecordsString = str;
                this.MultiPageSelectionLoaded = true;
            }
            else
            {
                this.SelectedRecordsString = "";
            }
        }

        protected virtual void CreateSerializedColumnsContainer()
        {
            GridRenderContainer child = new GridRenderContainer();
            child.Style["display"] = "none";
            this.SerializedColumnsContainer = new HtmlInputHidden();
            this.SerializedColumnsContainer.ID = this.GetSerializedColumnsContainerID();
            if (this.sTempSerializedColumnsString != null)
            {
                this.SerializedColumnsContainer.Value = this.sTempSerializedColumnsString;
            }
            child.Controls.Add(this.SerializedColumnsContainer);
            this.mainContainer.Controls.Add(child);
        }

        protected virtual void CreateSortExpressionContainer()
        {
            this.oSortExpression = new HtmlInputHidden();
            this.oSortExpression.ID = "ob_" + this.GridID + "SortExpression";
            this.oSortExpression.Value = this.SortExpression;
            this.Controls.Add(this.oSortExpression);
            this.oSortOrder = new HtmlInputHidden();
            this.oSortOrder.ID = "ob_" + this.GridID + "SortOrder";
            this.oSortOrder.Value = this.SortOrder;
            this.Controls.Add(this.oSortOrder);
        }

        internal virtual GridTemplate CreateTemplate(string templateId, string value, Column col, GridGroupInformation groupInfo)
        {
            return this.CreateTemplate(templateId, value, null, null, 0, 0, true, col, groupInfo);
        }

        internal virtual GridTemplate CreateTemplate(string sTemplateId, string sValue, Hashtable oRowValues, object oDataObject, int iPageRecordIndex, int iRecordIndex)
        {
            return this.CreateTemplate(sTemplateId, sValue, oRowValues, oDataObject, iPageRecordIndex, iRecordIndex, true);
        }

        internal virtual GridTemplate CreateTemplate(string sTemplateId, string sValue, Hashtable oRowValues, object oDataObject, int iPageRecordIndex, int iRecordIndex, bool bindToData)
        {
            return this.CreateTemplate(sTemplateId, sValue, oRowValues, oDataObject, iPageRecordIndex, iRecordIndex, bindToData, null, null);
        }

        internal virtual GridTemplate CreateTemplate(string sTemplateId, string sValue, Hashtable oRowValues, object oDataObject, int iPageRecordIndex, int iRecordIndex, bool bindToData, Column col, GridGroupInformation groupInfo)
        {
            GridTemplate template = null;
            GridRuntimeTemplate template2 = null;
            GridTemplate byId = null;
            GridRuntimeTemplate runtimeTemplateById = null;
            if (this.Templates.GetById(sTemplateId) is GridRuntimeTemplate)
            {
                runtimeTemplateById = this.Templates.GetRuntimeTemplateById(sTemplateId);
                if (runtimeTemplateById == null)
                {
                    throw new InvalidTemplateIDException(sTemplateId);
                }
                template2 = runtimeTemplateById.Clone() as GridRuntimeTemplate;
            }
            else
            {
                byId = this.Templates.GetById(sTemplateId);
                if (byId == null)
                {
                    throw new InvalidTemplateIDException(sTemplateId);
                }
                template = byId.Clone() as GridTemplate;
            }
            if (template != null)
            {
                if (this.IsDesignTimeRender)
                {
                    template.DataBind();
                }
                template.Container.Value = sValue;
                template.Container.DataItem = oRowValues;
                template.Container.DataObject = oDataObject;
                template.Container.PageRecordIndex = iPageRecordIndex;
                template.Container.RecordIndex = iRecordIndex;
                template.Container.GridClientID = this.GridID;
                template.Container.Column = col;
                template.Container.Group = groupInfo;
                if (bindToData)
                {
                    template.ForceDataBind();
                }
                string clientID = template.ClientID;
                if (!string.IsNullOrEmpty(this._templateSettings.RowEditTemplateId) && (this._templateSettings.RowEditTemplateId == sTemplateId))
                {
                    this.RowEditTemplate = template;
                }
            }
            if (template2 != null)
            {
                if (template2.Container == null)
                {
                    template2.InstantiateTemplate();
                }
                template2.Container.Value = sValue;
                template2.Container.DataItem = oRowValues;
                template2.Container.DataObject = oDataObject;
                template2.Container.PageRecordIndex = iPageRecordIndex;
                template2.Container.RecordIndex = iRecordIndex;
                template2.Container.GridClientID = this.GridID;
                template2.Container.Column = col;
                template2.Container.Group = groupInfo;
                template2.DataBind();
                string text2 = template2.ClientID;
                if (!string.IsNullOrEmpty(this._templateSettings.RowEditTemplateId) && (this._templateSettings.RowEditTemplateId == sTemplateId))
                {
                    this.RowEditTemplate = template2;
                }
            }
            if (template != null)
            {
                return template;
            }
            return template2;
        }

        protected virtual void CreateTotalNumberOfRecordsContainer()
        {
            this.TotalNumberOfRecordsContainer = new GridHtmlInputHidden();
            this.TotalNumberOfRecordsContainer.ID = "ob_" + this.GridID + "TotalRecords";
            this.TotalNumberOfRecordsContainer.Value = this.TotalRecords.ToString();
            this.mainContainer.Controls.Add(this.TotalNumberOfRecordsContainer);
        }

        protected virtual void CreateViewStateContainer()
        {
            this.ViewStateContainer = new HtmlInputHidden();
            this.ViewStateContainer.ID = this.GetViewStateContainerID();
            if ((this.CallbackMode && this.Serialize) && this.ViewStateChanged)
            {
                if (this.__ViewState == null)
                {
                    this.__ViewState = "";
                }
                if ((!this.IsPostBack || !(this is DetailGrid)) || ((this.DetailGrids.Count != 0) || this.IsInCallbackHierarchy()))
                {
                    this.ViewStateContainer.Value = GridEncodingHelper.XMLCdataEncode(this.__ViewState);
                }
            }
            this.mainContainer.Controls.Add(this.ViewStateContainer);
        }

        private DataSet DecompressDataSet(byte[] bytDs)
        {
            DataSet set = new DataSet();
            MemoryStream stream = new MemoryStream(bytDs);
            stream.Seek(0L, SeekOrigin.Begin);
            using (DeflateStream stream2 = new DeflateStream(stream, CompressionMode.Decompress, true))
            {
                byte[] buffer = this.ReadFullStream(stream2);
                stream2.Flush();
                stream2.Close();
                MemoryStream serializationStream = new MemoryStream(buffer);
                serializationStream.Seek(0L, SeekOrigin.Begin);
                set.RemotingFormat = System.Data.SerializationFormat.Binary;
                BinaryFormatter formatter = new BinaryFormatter();
                return (DataSet) formatter.Deserialize(serializationStream, null);
            }
        }

        protected virtual bool DeleteOperationCallback(int affectedRows, Exception ex)
        {
            this.OnRebind();
            return true;
        }

        public virtual void DeleteRow(GridRecordEventArgs args)
        {
            DataSourceView data = this.GetData();
            if (this.GetDeleteCommand() != null)
            {
                this.OnDeleteCommand(args);
            }
            else if (data.CanDelete)
            {
                IDataSource dataSource = this.GetDataSource();
                if (args.Record != null)
                {
                    ParameterCollection deleteParameters = null;
                    if (dataSource is SqlDataSource)
                    {
                        deleteParameters = (dataSource as SqlDataSource).DeleteParameters;
                    }
                    else if (dataSource is ObjectDataSource)
                    {
                        deleteParameters = (dataSource as ObjectDataSource).DeleteParameters;
                    }
                    Hashtable keys = new Hashtable();
                    if ((deleteParameters != null) && (deleteParameters.Count > 0))
                    {
                        foreach (Parameter parameter in deleteParameters)
                        {
                            keys.Add(parameter.Name, args.Record[parameter.Name]);
                        }
                    }
                    else
                    {
                        keys = args.Record;
                    }
                    data.Delete(keys, null, new DataSourceViewOperationCallback(this.DeleteOperationCallback));
                }
                else if (args.RecordsCollection != null)
                {
                    int num = 0;
                    foreach (Hashtable hashtable2 in args.RecordsCollection)
                    {
                        if (num < (args.RecordsCollection.Count - 1))
                        {
                            data.Delete(hashtable2, null, new DataSourceViewOperationCallback(this.OperationDummyCallback));
                        }
                        else
                        {
                            data.Delete(hashtable2, null, new DataSourceViewOperationCallback(this.DeleteOperationCallback));
                        }
                        num++;
                    }
                }
                this.StoreEventInformation("DELETE", args);
            }
            this.executedCommandType = "DELETE";
        }

        private void DeserializeColumnsCollection(string sSerializedColumns)
        {
            if (!this.ColumnsDeserializationApplied)
            {
                string[] strArray = this.SplitByString(sSerializedColumns, this.ArrayElementsSeparator);
                int index = 0;
                foreach (string str in strArray)
                {
                    if (this.AutoGenerateColumns)
                    {
                        string[] strArray2 = this.SplitByString(str, this.ObjectPropertiesSeparator);
                        if (!string.IsNullOrEmpty(strArray2[0]))
                        {
                            Column oCol = new Column {
                                DataField = strArray2[0]
                            };
                            this.Cols.Add(oCol);
                        }
                    }
                    else
                    {
                        string[] strArray3 = this.SplitByString(str, this.ObjectPropertiesSeparator);
                        if (((this.Cols[index] == null) && !string.IsNullOrEmpty(strArray3[0])) && (((this.Columns.GetColumnByDataField(strArray3[0]) == null) || (this.ScrollingSettings.NumberOfFixedColumns <= 0)) || (this.ScrollingSettings.FixedColumnsPosition != GridFixedColumnsPositionType.Right)))
                        {
                            Column column3 = new Column {
                                DataField = strArray3[0]
                            };
                            this.Cols.Add(column3);
                        }
                    }
                    index++;
                }
                this.GenerateColumnIndexes();
                foreach (Column column4 in this.Cols)
                {
                    string str2 = !string.IsNullOrEmpty(column4.DataField) ? column4.DataField : ("ob_temp_col_" + column4.Index.ToString());
                    column4.TempDataField = str2;
                }
                index = 0;
                foreach (string str3 in strArray)
                {
                    try
                    {
                        string[] strArray4 = this.SplitByString(str3, this.ObjectPropertiesSeparator);
                        Column columnByTempDataField = null;
                        if (!string.IsNullOrEmpty(strArray4[7]))
                        {
                            columnByTempDataField = this.Cols.GetColumnByTempDataField(strArray4[7]);
                        }
                        else
                        {
                            columnByTempDataField = this.Cols.GetColumnByIndex(index);
                        }
                        if (strArray4[1] == "None")
                        {
                            columnByTempDataField.SortOrder = SortOrderType.None;
                        }
                        else if (strArray4[1] == "Asc")
                        {
                            columnByTempDataField.SortOrder = SortOrderType.Asc;
                        }
                        else
                        {
                            columnByTempDataField.SortOrder = SortOrderType.Desc;
                        }
                        columnByTempDataField.SortPriority = int.Parse(strArray4[2], CultureInfo.InvariantCulture);
                        columnByTempDataField.GroupBy = bool.Parse(strArray4[3]);
                        columnByTempDataField.GroupByPriority = int.Parse(strArray4[4], CultureInfo.InvariantCulture);
                        columnByTempDataField.Visible = bool.Parse(strArray4[5]);
                        columnByTempDataField.Index = int.Parse(strArray4[6]);
                    }
                    catch (Exception exception1)
                    {
                        if (exception1 != null)
                        {
                        }
                    }
                    index++;
                }
                this.ColumnsDeserializationApplied = true;
            }
        }

        protected virtual IEnumerable DeserializeDataSource()
        {
            DataView defaultView = new DataView();
            string s = "";
            if (!this.CallbackMode && !this.IsDesignTimeRender)
            {
                object obj2 = this.ViewState["DataSource"];
                if (obj2 != null)
                {
                    s = obj2.ToString();
                }
            }
            else if ((this.IsCallback || this.IsPostBack) && (this.__ViewState != null))
            {
                s = this.__ViewState;
            }
            if (s != string.Empty)
            {
                byte[] bytDs = Convert.FromBase64String(s);
                defaultView = this.DecompressDataSet(bytDs).Tables[0].DefaultView;
            }
            return defaultView;
        }

        private string EncodeStringForFiltering(string sStringToEncode)
        {
            return sStringToEncode.Replace("'", "''").Replace("[", "__bs1____bs1__[__bs2____bs2__").Replace("]", "__bs1____bs1__]__bs2____bs2__").Replace("*", "[*]").Replace("%", "[%]").Replace(@"\", @"[\]").Replace("__bs1____bs1__", "[").Replace("__bs2____bs2__", "]");
        }

        protected virtual void ExecuteCommands(string sExecuteCommand, string sCommandVariables)
        {
            if (!this.commandsExecuted)
            {
                if (sExecuteCommand != "MULTIPLE")
                {
                    GridRecordEventArgs args = new GridRecordEventArgs {
                        Record = this.CreateCommandEventArgs(sCommandVariables),
                        RecordsCollection = null
                    };
                    if (sExecuteCommand == "UPDATE")
                    {
                        this.UpdateRow(args);
                    }
                    else if (sExecuteCommand == "DELETE")
                    {
                        this.DeleteRow(args);
                    }
                    else if (sExecuteCommand == "INSERT")
                    {
                        this.InsertRow(args);
                    }
                }
                else
                {
                    string[] strArray = this.SplitByString(sCommandVariables, this.CommandsSeparator);
                    int num = 0;
                    foreach (string str in strArray)
                    {
                        if ((str != string.Empty) && (str != "NULL"))
                        {
                            GridRecordEventArgs args2 = new GridRecordEventArgs {
                                Record = null,
                                RecordsCollection = new ArrayList()
                            };
                            foreach (string str2 in this.SplitByString(str, this.ArrayElementsSeparator))
                            {
                                args2.RecordsCollection.Add(this.CreateCommandEventArgs(str2));
                            }
                            switch (num)
                            {
                                case 0:
                                    this.InsertRow(args2);
                                    break;

                                case 1:
                                    this.UpdateRow(args2);
                                    break;

                                case 2:
                                    this.DeleteRow(args2);
                                    break;
                            }
                        }
                        num++;
                    }
                }
                this.commandsExecuted = true;
            }
        }

        private void ExecuteRebinding(bool forced)
        {
            if (base.IsBoundUsingDataSourceID)
            {
                if (!this.Serialize || this.NeedToApplyRebinding)
                {
                    if (!(this is DetailGrid) || (this.MasterDetailSettings.LoadingMode == DetailGridLoadingMode.OnLoad))
                    {
                        this.PerformSelect();
                    }
                    else
                    {
                        this.EnsureChildControls();
                    }
                }
                else
                {
                    if (!(this is DetailGrid) || !string.IsNullOrEmpty(this.__ViewState))
                    {
                        this.DataSourceID = string.Empty;
                        this.preventPreviousDataSourceClearing = true;
                        this.DataSource = this.DeserializeDataSource();
                        this.preventPreviousDataSourceClearing = false;
                    }
                    this.PerformDataBinding(this.DataSource as IEnumerable);
                }
            }
            else if (this.Serialize)
            {
                if (!this.NeedToApplyRebinding)
                {
                    if (!(this is DetailGrid) || !string.IsNullOrEmpty(this.__ViewState))
                    {
                        this.preventPreviousDataSourceClearing = true;
                        this.DataSource = this.DeserializeDataSource();
                        this.preventPreviousDataSourceClearing = false;
                    }
                    this.PerformDataBinding(this.DataSource as IEnumerable);
                }
                else if (this.NeedToApplyRebinding)
                {
                    this.OnRebind();
                }
            }
            else if (!this.NeedToApplyRebinding)
            {
                if (this.DataSource != null)
                {
                    if (!forced)
                    {
                        return;
                    }
                    this.DataBind();
                }
            }
            else
            {
                this.OnRebind();
            }
            this.NeedRebinding = false;
        }

        internal virtual string Export(Html32TextWriter oHtmlTextWriter, Control container)
        {
            StringWriter writer = new StringWriter();
            if (container == null)
            {
                oHtmlTextWriter = new Html32TextWriter(writer);
            }
            this.columnIndexesToExport = new List<int>();
            if (string.IsNullOrEmpty(this.ExportingSettings.ColumnsToExport))
            {
                for (int i = 0; i < this.Columns.Count; i++)
                {
                    if ((this.Columns[i].Visible || this.ExportingSettings.ExportHiddenColumns) && (!this.Columns[i].AllowEdit && !this.Columns[i].AllowDelete))
                    {
                        this.columnIndexesToExport.Add(i);
                    }
                }
            }
            else
            {
                foreach (string str in this.ExportingSettings.ColumnsToExport.Split(new char[] { ',' }))
                {
                    this.columnIndexesToExport.Add(this.Columns.GetColumnIndexByDataField(str));
                }
            }
            this.exportedGrid = new Table();
            this.exportedGrid.GridLines = GridLines.Both;
            this.exportedGrid.BorderColor = Color.Black;
            this.exportedGrid.BorderWidth = 1;
            this.OnExporting(this.exportedGrid);
            if (this.ShowHeader)
            {
                this.header.Export(oHtmlTextWriter);
            }
            this.body.Export(container);
            if (this.ShowColumnsFooter && this.ExportingSettings.ExportColumnsFooter)
            {
                this.columnsFooter.Export(oHtmlTextWriter);
            }
            this.OnExported(this.exportedGrid);
            if (container == null)
            {
                this.exportedGrid.RenderControl(oHtmlTextWriter);
            }
            else
            {
                container.Controls.Add(this.exportedGrid);
            }
            return writer.ToString();
        }

        protected virtual void ExportToClient()
        {
            string str = "";
            string str2 = "";
            string exportType = this.exportType;
            if (exportType != null)
            {
                if (!(exportType == "excel"))
                {
                    if (exportType == "word")
                    {
                        str = "application/vnd.doc";
                        str2 = ".doc";
                    }
                }
                else
                {
                    str = "application/vnd.xls";
                    str2 = ".xls";
                }
            }
            this.Page.Response.Clear();
            this.Page.Response.Buffer = true;
            Encoding aSCII = null;
            switch (this.ExportingSettings.Encoding)
            {
                case GridExportEncoding.ASCII:
                    aSCII = Encoding.ASCII;
                    break;

                case GridExportEncoding.BigEndianUnicode:
                    aSCII = Encoding.BigEndianUnicode;
                    break;

                case GridExportEncoding.Default:
                    aSCII = Encoding.Default;
                    break;

                case GridExportEncoding.Unicode:
                    aSCII = Encoding.Unicode;
                    break;

                case GridExportEncoding.UTF32:
                    aSCII = Encoding.UTF32;
                    break;

                case GridExportEncoding.UTF7:
                    aSCII = Encoding.UTF7;
                    break;

                case GridExportEncoding.UTF8:
                    aSCII = Encoding.UTF8;
                    break;
            }
            this.Page.Response.ContentEncoding = aSCII;
            if (this.ExportingSettings.Encoding != GridExportEncoding.Default)
            {
                this.Page.Response.BinaryWrite(aSCII.GetPreamble());
            }
            this.Page.Response.ContentType = str;
            this.Page.Response.AddHeader("Content-Disposition", "attachment;filename=" + this.ExportingSettings.FileName + (this.ExportingSettings.AppendTimeStamp ? ("_" + DateTime.Now.Ticks.ToString()) : "") + str2);
            this.Page.Response.Charset = "";
            this.Page.Response.Write(this.Export(null, null));
            this.Page.Response.End();
        }

        public string ExportToExcel()
        {
            this.exportType = "excel";
            return this.ExportToServer();
        }

        public string ExportToExcel(string sFileName, bool bKeepFormatting, bool bUsePaging, bool bAppendTimeStamp, bool bOffice2007)
        {
            return this.ExportToExcel(sFileName, bKeepFormatting, bUsePaging, bAppendTimeStamp, bOffice2007, false, "");
        }

        public string ExportToExcel(string sFileName, bool bKeepFormatting, bool bUsePaging, bool bAppendTimeStamp, bool bOffice2007, bool bExportHiddenColumns, string sColumnsToExport)
        {
            this.exportType = "excel";
            this.ExportingSettings.FileName = sFileName;
            this.ExportingSettings.KeepColumnSettings = bKeepFormatting;
            this.ExportingSettings.ExportAllPages = !bUsePaging;
            this.ExportingSettings.AppendTimeStamp = bAppendTimeStamp;
            this.ExportingSettings.ExportHiddenColumns = bExportHiddenColumns;
            this.ExportingSettings.ColumnsToExport = sColumnsToExport;
            return this.ExportToServer();
        }

        protected virtual string ExportToServer()
        {
            this.ExecuteRebinding(true);
            string str = "";
            string exportType = this.exportType;
            if (exportType != null)
            {
                if (!(exportType == "excel"))
                {
                    if (exportType == "word")
                    {
                        str = ".doc";
                    }
                }
                else
                {
                    str = ".xls";
                }
            }
            string str2 = this.ExportingSettings.FileName + (this.ExportingSettings.AppendTimeStamp ? ("_" + DateTime.Now.Ticks.ToString()) : "") + str;
            string path = HttpContext.Current.Server.MapPath(this.FolderExports) + @"\" + str2;
            if (this.ExportingSettings.ExportedFilesLifeTime != -1)
            {
                this.RemoveExportedFiles();
            }
            FileStream stream = new FileStream(path, FileMode.Create);
            int pageSize = this.PageSize;
            if (this.ExportingSettings.ExportAllPages)
            {
                this.PageSize = -1;
                if (pageSize != this.PageSize)
                {
                    this.DataBind();
                }
            }
            Encoding aSCII = null;
            switch (this.ExportingSettings.Encoding)
            {
                case GridExportEncoding.ASCII:
                    aSCII = Encoding.ASCII;
                    break;

                case GridExportEncoding.BigEndianUnicode:
                    aSCII = Encoding.BigEndianUnicode;
                    break;

                case GridExportEncoding.Default:
                    aSCII = Encoding.Default;
                    break;

                case GridExportEncoding.Unicode:
                    aSCII = Encoding.Unicode;
                    break;

                case GridExportEncoding.UTF32:
                    aSCII = Encoding.UTF32;
                    break;

                case GridExportEncoding.UTF7:
                    aSCII = Encoding.UTF7;
                    break;

                case GridExportEncoding.UTF8:
                    aSCII = Encoding.UTF8;
                    break;
            }
            byte[] bytes = aSCII.GetBytes(this.Export(null, null));
            int offset = 0;
            if (this.ExportingSettings.Encoding != GridExportEncoding.Default)
            {
                byte[] preamble = aSCII.GetPreamble();
                stream.Write(preamble, 0, preamble.Length);
            }
            stream.Write(bytes, offset, bytes.Length);
            stream.Close();
            if (this.ExportingSettings.ExportAllPages && (pageSize != this.PageSize))
            {
                this.PageSize = pageSize;
                this.DataBind();
            }
            return str2;
        }

        public string ExportToWord()
        {
            this.exportType = "word";
            return this.ExportToServer();
        }

        public string ExportToWord(string sFileName, bool bKeepFormatting, bool bUsePaging, bool bAppendTimeStamp, bool bOffice2007)
        {
            return this.ExportToWord(sFileName, bKeepFormatting, bUsePaging, bAppendTimeStamp, bOffice2007, false, "");
        }

        public string ExportToWord(string sFileName, bool bKeepFormatting, bool bUsePaging, bool bAppendTimeStamp, bool bOffice2007, bool bExportHiddenColumns, string sColumnsToExport)
        {
            this.exportType = "word";
            this.ExportingSettings.FileName = sFileName;
            this.ExportingSettings.KeepColumnSettings = bKeepFormatting;
            this.ExportingSettings.ExportAllPages = !bUsePaging;
            this.ExportingSettings.AppendTimeStamp = bAppendTimeStamp;
            this.ExportingSettings.ExportHiddenColumns = bExportHiddenColumns;
            this.ExportingSettings.ColumnsToExport = sColumnsToExport;
            return this.ExportToServer();
        }

        private object FindControl(Control where, string id)
        {
            foreach (Control control in where.Controls)
            {
                if (control.ID == id)
                {
                    return control;
                }
                if (control.HasControls())
                {
                    object obj2 = this.FindControl(control, id);
                    if (obj2 != null)
                    {
                        return obj2;
                    }
                }
            }
            return null;
        }

        internal void GenerateColumnIndexes()
        {
            this.GenerateColumnIndexes(false);
        }

        internal void GenerateColumnIndexes(bool forceGeneration)
        {
            if (!this.ColumnsIndexesGenerated || forceGeneration)
            {
                string str = "|";
                foreach (Column column in this.Columns)
                {
                    if (column.Index != -1)
                    {
                        str = str + column.Index.ToString() + "|";
                    }
                }
                int index = -1;
                foreach (Column column2 in this.Columns)
                {
                    if (column2.Index == -1)
                    {
                        index++;
                        while (str.IndexOf("|" + index.ToString() + "|") != -1)
                        {
                            index++;
                        }
                        column2.Index = index;
                    }
                    else if (column2.Index == (index + 1))
                    {
                        index = column2.Index;
                    }
                }
                this.Columns.Sort();
                this.ColumnsIndexesGenerated = true;
            }
        }

        private void GenerateGroupByExpression()
        {
            string str = "";
            this.Cols.SortByGroupByPriority();
            foreach (Column column in this.Cols)
            {
                if (((column.DataField != "") && column.GroupBy) && column.AllowGroupBy)
                {
                    if (str != string.Empty)
                    {
                        str = str + ",";
                    }
                    str = str + column.DataField;
                }
            }
            this.GroupBy = str;
            this.Cols.Sort();
        }

        protected virtual string GetCallbackResult()
        {
            StringBuilder builder = new StringBuilder();
            StringWriter writer = new StringWriter(CultureInfo.InvariantCulture);
            HtmlTextWriter tw = new HtmlTextWriter(writer);
            VdcHtmlTextWriter writer3 = new VdcHtmlTextWriter(tw, "");
            new JavaScriptSerializer();
            this.CheckIfNeedsEmptyDataSource();
            this.UpdateEditTemplatesClientIdsReferences();
            this.UpdatePostbackModeEditTemplatesClientIdsReferences();
            if (this.AllowFiltering)
            {
                this.UpdateFilterTemplatesClientIdsReferences();
                this.UpdateFilterOptionsTemplatesClientIdsReferences();
            }
            this.CreateElementsClientIdsContent();
            foreach (Control control in this.mainContainer.Controls)
            {
                if (control is GridFooter)
                {
                    ((GridFooter) control).ForceEnsureChildControls();
                }
                else if (control is GridColumnsFooter)
                {
                    ((GridColumnsFooter) control).ForceEnsureChildControls();
                }
                control.RenderControl(writer3);
            }
            builder.Append(writer.ToString());
            builder.Append(this._callbackResultSeparator);
            builder.Append(this.CreateColumnsCollectionClientSideCode());
            return builder.ToString();
        }

        protected virtual string GetCellDivsWidthContainerID()
        {
            return ("ob_" + this.GridID + "CellDivsWidthContainer");
        }

        protected virtual string GetClientFilterExpressionContainerID()
        {
            return ("ob_" + this.GridID + "CFEC");
        }

        protected virtual string GetColumnsWidthContainerID()
        {
            return ("ob_" + this.GridID + "ColumnsWidthContainer");
        }

        private void GetColumnTypes()
        {
            if (!this.bColumnTypesLoaded && (this.internalDataSource is DataView))
            {
                DataView internalDataSource = this.internalDataSource as DataView;
                DataTable table = internalDataSource.Table;
                foreach (Column column in this.Columns)
                {
                    if (!string.IsNullOrEmpty(column.DataField))
                    {
                        try
                        {
                            column.Type = table.Columns[column.DataField].DataType.ToString();
                            column.MaxLength = table.Columns[column.DataField].MaxLength;
                            column.AllowNulls = table.Columns[column.DataField].AllowDBNull;
                        }
                        catch (Exception exception1)
                        {
                            if (exception1 != null)
                            {
                            }
                        }
                        this.bColumnTypesLoaded = true;
                    }
                }
            }
        }

        private string GetControlIDForTemplate(Control oControl, string id)
        {
            if (oControl == null)
            {
                return id;
            }
            Control control = this.FindControl(oControl, id) as Control;
            if (control == null)
            {
                return id;
            }
            Type baseType = control.GetType();
            bool flag = false;
            while (baseType != null)
            {
                if ((((baseType.ToString() == "Vdc.Interface.VdcTextBox") || (baseType.ToString() == "Vdc.Interface.VdcCheckBox")) || ((baseType.ToString() == "Vdc.ComboBox.ComboBox") || (baseType.ToString() == "Vdc.Interface.VdcDropDownList"))) || ((baseType.ToString() == "Vdc.ListBox.ListBox") || (baseType.ToString() == "Vdc.Interface.VdcRadioButton")))
                {
                    flag = true;
                    break;
                }
                try
                {
                    baseType = Activator.CreateInstance(baseType).GetType().BaseType;
                    continue;
                }
                catch
                {
                    break;
                }
            }
            if (flag)
            {
                return control.ID;
            }
            return control.ClientID;
        }

        private string GetControlPropertyNameForTemplate(Control oControl, string id)
        {
            if (oControl != null)
            {
                Control control = this.FindControl(oControl, id) as Control;
                if (control == null)
                {
                    return "value";
                }
                if ((control is CheckBox) || (control is RadioButton))
                {
                    return "checked";
                }
            }
            return "value";
        }

        protected virtual EventHandler GetDeleteCommand()
        {
            return this.DeleteCommand;
        }

        protected virtual void GetElementsClientIds()
        {
            this.elementsClientIds.MainContainerID = this.mainContainer.ClientID;
            if (this.heading != null)
            {
                this.elementsClientIds.HeadingContainerID = this.heading.ClientID;
            }
            if (this.groupingArea != null)
            {
                this.elementsClientIds.GroupingAreaContainerID = this.groupingArea.ClientID;
            }
            if (this.header != null)
            {
                this.elementsClientIds.HeaderContainerID = this.header.ClientID;
            }
            if (this.body != null)
            {
                this.elementsClientIds.BodyContainerID = this.body.ClientID;
            }
            if (this.footer != null)
            {
                this.elementsClientIds.FooterContainerID = this.footer.ClientID;
            }
            if (this.topFooter != null)
            {
                this.elementsClientIds.TopFooterContainerID = this.topFooter.ClientID;
            }
            if (this.horizontalScroller != null)
            {
                this.elementsClientIds.HorizontalScrollerID = this.horizontalScroller.ClientID;
            }
            if (this.filter != null)
            {
                this.elementsClientIds.FilterContainerID = this.filter.ClientID;
            }
            if ((this.footer != null) && (this.footer.AddRecordLink != null))
            {
                this.elementsClientIds.AddRecordLinkID = this.footer.AddRecordLink.ClientID;
            }
            if ((this.topFooter != null) && (this.topFooter.AddRecordLink != null))
            {
                this.elementsClientIds.TopAddRecordLinkID = this.topFooter.AddRecordLink.ClientID;
            }
            if ((this.footer != null) && (this.footer.AddRecordLinkContainer != null))
            {
                this.elementsClientIds.FooterActionLinksContainerID = this.footer.AddRecordLinkContainer.ClientID;
            }
            if ((this.topFooter != null) && (this.topFooter.AddRecordLinkContainer != null))
            {
                this.elementsClientIds.TopFooterActionLinksContainerID = this.topFooter.AddRecordLinkContainer.ClientID;
            }
            if (this.PageSelector != null)
            {
                this.elementsClientIds.PageSelectorID = this.PageSelector.ClientID;
            }
            if (this.TotalNumberOfRecordsContainer != null)
            {
                this.elementsClientIds.TotalNumberOfRecordsContainerID = this.TotalNumberOfRecordsContainer.ClientID;
            }
            if ((this.footer != null) && (this.footer.PageSizeSelector != null))
            {
                this.elementsClientIds.PageSizeSelectorID = this.footer.PageSizeSelector.ID;
            }
            if ((this.topFooter != null) && (this.topFooter.PageSizeSelector != null))
            {
                this.elementsClientIds.TopPageSizeSelectorID = this.topFooter.PageSizeSelector.ID;
            }
            if (this.SerializedColumnsContainer != null)
            {
                this.elementsClientIds.SerializedColumnsContainerID = this.SerializedColumnsContainer.ClientID;
            }
            if (this.oSortExpression != null)
            {
                this.elementsClientIds.SortExpressionContainerID = this.oSortExpression.ClientID;
            }
            if (this.oSortOrder != null)
            {
                this.elementsClientIds.SortOrderContainerID = this.oSortOrder.ClientID;
            }
            if (this.ViewStateContainer != null)
            {
                this.elementsClientIds.ViewStateContainerID = this.ViewStateContainer.ClientID;
            }
            if (this.SelectedRecordsContainer != null)
            {
                this.elementsClientIds.SelectedRecordsContainerID = this.SelectedRecordsContainer.ClientID;
            }
            if (this.SelectedRecordsIndexesContainer != null)
            {
                this.elementsClientIds.SelectedRecordsIndexesContainerID = this.SelectedRecordsIndexesContainer.ClientID;
            }
            if (this.newRecordEditTemplateContainer != null)
            {
                this.elementsClientIds.NewRecordEditTemplateContainerID = this.newRecordEditTemplateContainer.ClientID;
            }
            if (this.topNewRecordEditTemplateContainer != null)
            {
                this.elementsClientIds.TopNewRecordEditTemplateContainerID = this.topNewRecordEditTemplateContainer.ClientID;
            }
            if ((this.footer != null) && (this.footer.AddMultiRecordLinkContainer != null))
            {
                this.elementsClientIds.MultiActionLinksContainerID = this.footer.AddMultiRecordLinkContainer.ClientID;
            }
            if ((this.topFooter != null) && (this.topFooter.AddMultiRecordLinkContainer != null))
            {
                this.elementsClientIds.TopMultiActionLinksContainerID = this.topFooter.AddMultiRecordLinkContainer.ClientID;
            }
            if (this.multiRecordTemplateSettingsContainer != null)
            {
                this.elementsClientIds.MultiRecordTemplateSettingsContainerID = this.multiRecordTemplateSettingsContainer.ClientID;
            }
            if (this.scrollingCell != null)
            {
                this.elementsClientIds.HeaderScrollingCellID = this.scrollingCell.ClientID;
            }
            if (this.FilteringButtonsConfiguration != null)
            {
                this.elementsClientIds.FilteringButtonsConfigurationContainerID = this.FilteringButtonsConfiguration.ClientID;
            }
            if (this.ColumnsVisibleStateContainer != null)
            {
                this.elementsClientIds.ColumnsVisibleStateContainerID = this.ColumnsVisibleStateContainer.ClientID;
            }
            if (this.ColumnsWidthContainer != null)
            {
                this.elementsClientIds.ColumnsWidthContainerID = this.ColumnsWidthContainer.ClientID;
            }
            if (this.CellDivsWidthContainer != null)
            {
                this.elementsClientIds.CellDivsWidthContainerID = this.CellDivsWidthContainer.ClientID;
            }
            if (this.editTemplatesContainer != null)
            {
                this.elementsClientIds.EditTemplatesContainerID = this.editTemplatesContainer.ClientID;
            }
            if (this.filterOptionsTemplatesContainer != null)
            {
                this.elementsClientIds.FilterOptionsTemplatesContainerID = this.filterOptionsTemplatesContainer.ClientID;
            }
            if ((this.footer != null) && (this.footer.ManualPagingTextbox != null))
            {
                this.elementsClientIds.ManualPagingTextboxID = this.footer.ManualPagingTextbox.ID;
            }
            if ((this.topFooter != null) && (this.topFooter.ManualPagingTextbox != null))
            {
                this.elementsClientIds.TopManualPagingTextboxID = this.topFooter.ManualPagingTextbox.ID;
            }
            if ((this.footer != null) && (this.footer.FilterLinksContainer != null))
            {
                this.elementsClientIds.FooterFilterLinksContainerID = this.footer.FilterLinksContainer.ClientID;
            }
            if ((this.topFooter != null) && (this.topFooter.FilterLinksContainer != null))
            {
                this.elementsClientIds.TopFooterFilterLinksContainerID = this.topFooter.FilterLinksContainer.ClientID;
            }
            if (this.ClientFilterExpressionContainer != null)
            {
                this.elementsClientIds.ClientFilterExpressionContainerID = this.ClientFilterExpressionContainer.ClientID;
            }
            if (this.exportedFileNameContainer != null)
            {
                this.elementsClientIds.ExportedFileNameContainerID = this.exportedFileNameContainer.ClientID;
            }
            if (this.commandsParametersContainer != null)
            {
                this.elementsClientIds.CommandsParametersContainerID = this.commandsParametersContainer.ClientID;
            }
            if (this.rowEditTemplateContainer != null)
            {
                this.elementsClientIds.RowEditTemplateContainerID = this.rowEditTemplateContainer.ClientID;
            }
            if (this.filterButtonsTemplatesContainer != null)
            {
                this.elementsClientIds.FilterButtonsTemplatesContainerID = this.filterButtonsTemplatesContainer.ClientID;
            }
            if (this.callbackErrorContainer != null)
            {
                this.elementsClientIds.CallbackErrorContainerID = this.callbackErrorContainer.ClientID;
            }
            if (this.expandedMasterRowsContainer != null)
            {
                this.elementsClientIds.ExpandedMasterRowsContainerID = this.expandedMasterRowsContainer.ClientID;
            }
            if (this.postbackElement != null)
            {
                this.elementsClientIds.PostbackElementID = this.postbackElement.ClientID;
            }
            if (this.body.loadingMessageContainer != null)
            {
                this.elementsClientIds.LoadingMessageContainerID = this.body.loadingMessageContainer.ClientID;
            }
            if (this.headerCornersContainer != null)
            {
                this.elementsClientIds.HeaderCornersContainerID = this.headerCornersContainer.ClientID;
            }
            if (this.footerCornersContainer != null)
            {
                this.elementsClientIds.FooterCornersContainerID = this.footerCornersContainer.ClientID;
            }
        }

        protected virtual Dictionary<string, string> GetForeignKeysDictionary()
        {
            return new Dictionary<string, string>();
        }

        protected virtual string GetForeignKeysValues()
        {
            return "{}";
        }

        internal string GetHashValueByDataField(Hashtable hash, string dataField)
        {
            foreach (DictionaryEntry entry in hash)
            {
                if (entry.Key.ToString().ToLower() == dataField.ToLower())
                {
                    return ((entry.Value != null) ? entry.Value.ToString() : "");
                }
            }
            return null;
        }

        private string getId()
        {
            if ((this.ID != null) && !this.ID.Equals(string.Empty))
            {
                return this.ID;
            }
            return this.UniqueID;
        }

        private void GetImagesUrl()
        {
            if (string.IsNullOrEmpty(this.FolderStyle) && string.IsNullOrEmpty(this.ImagesPath))
            {
                this.ImagesURL.Header = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.header.png");
                this.ImagesURL.HeaderWithoutGrouping = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.header_without_grouping.png");
                this.ImagesURL.Header_Placeholder = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.header.gif");
                this.ImagesURL.PageNavigation_First_Normal = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.first_normal.gif");
                this.ImagesURL.PageNavigation_First_Over = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.first_over.gif");
                this.ImagesURL.PageNavigation_First_Pressed = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.first_pressed.gif");
                this.ImagesURL.PageNavigation_First_Disabled = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.first_disabled.gif");
                this.ImagesURL.PageNavigation_Previous_Normal = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.previous_normal.gif");
                this.ImagesURL.PageNavigation_Previous_Over = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.previous_over.gif");
                this.ImagesURL.PageNavigation_Previous_Pressed = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.previous_pressed.gif");
                this.ImagesURL.PageNavigation_Previous_Disabled = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.previous_disabled.gif");
                this.ImagesURL.PageNavigation_Next_Normal = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.next_normal.gif");
                this.ImagesURL.PageNavigation_Next_Over = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.next_over.gif");
                this.ImagesURL.PageNavigation_Next_Pressed = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.next_pressed.gif");
                this.ImagesURL.PageNavigation_Next_Disabled = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.next_disabled.gif");
                this.ImagesURL.PageNavigation_Last_Normal = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.last_normal.gif");
                this.ImagesURL.PageNavigation_Last_Over = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.last_over.gif");
                this.ImagesURL.PageNavigation_Last_Pressed = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.last_pressed.gif");
                this.ImagesURL.PageNavigation_Last_Disabled = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.last_disabled.gif");
                this.ImagesURL.PageNavigation_First_Normal_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.first_normal_top.gif");
                this.ImagesURL.PageNavigation_First_Over_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.first_over_top.gif");
                this.ImagesURL.PageNavigation_First_Pressed_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.first_pressed_top.gif");
                this.ImagesURL.PageNavigation_First_Disabled_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.first_disabled_top.gif");
                this.ImagesURL.PageNavigation_Previous_Normal_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.previous_normal_top.gif");
                this.ImagesURL.PageNavigation_Previous_Over_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.previous_over_top.gif");
                this.ImagesURL.PageNavigation_Previous_Pressed_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.previous_pressed_top.gif");
                this.ImagesURL.PageNavigation_Previous_Disabled_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.previous_disabled_top.gif");
                this.ImagesURL.PageNavigation_Next_Normal_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.next_normal_top.gif");
                this.ImagesURL.PageNavigation_Next_Over_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.next_over_top.gif");
                this.ImagesURL.PageNavigation_Next_Pressed_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.next_pressed_top.gif");
                this.ImagesURL.PageNavigation_Next_Disabled_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.next_disabled_top.gif");
                this.ImagesURL.PageNavigation_Last_Normal_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.last_normal_top.gif");
                this.ImagesURL.PageNavigation_Last_Over_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.last_over_top.gif");
                this.ImagesURL.PageNavigation_Last_Pressed_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.last_pressed_top.gif");
                this.ImagesURL.PageNavigation_Last_Disabled_Top = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.last_disabled_top.gif");
                this.ImagesURL.Sorting_Asc = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.asc.gif");
                this.ImagesURL.Sorting_Desc = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.desc.gif");
                this.ImagesURL.Placeholder = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.placeholder.gif");
                this.ImagesURL.PlaceholderEmpty = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.placeholder_empty.gif");
                this.ImagesURL.Grouping_BtnClose = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.group_btn_close.gif");
                this.ImagesURL.Grouping_BtnOpen = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.group_btn_open.gif");
                this.ImagesURL.Grouping_RecordGroupHeader = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.record_group_header.png");
                this.ImagesURL.Filtering_ShowCriterias = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.filter_criterias.gif");
                this.ImagesURL.Footer_Content = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.footer.png");
                this.ImagesURL.Details_BtnClose = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.details_btn_close.gif");
                this.ImagesURL.Details_BtnOpen = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.details_btn_open.gif");
                if (this.IsDesignTimeRender)
                {
                    this.ImagesURL.Grouping_GroupingArea = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.grouping_area.png");
                    this.ImagesURL.Grouping_GroupingAreaLeft = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.grouping_area_left.png");
                    this.ImagesURL.Grouping_GroupingAreaRight = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.grouping_area_right.png");
                    this.ImagesURL.RowNormal = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.row1.png");
                    this.ImagesURL.RowAlternate = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.row2.png");
                    this.ImagesURL.FooterCornerLeft = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.footer_corner_left.png");
                    this.ImagesURL.FooterCornerMiddle = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.footer_corner_middle.png");
                    this.ImagesURL.FooterCornerRight = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.footer_corner_right.png");
                    this.ImagesURL.HeaderCornerLeft = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.header_corner_left.png");
                    this.ImagesURL.HeaderCornerMiddle = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.header_corner_middle.png");
                    this.ImagesURL.HeaderCornerRight = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.header_corner_right.png");
                    this.ImagesURL.Grouping_GroupingAreaColumn = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.grouping_area_column.png");
                    this.ImagesURL.Grouping_GroupingAreaColumnLeft = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.grouping_area_column_left.png");
                    this.ImagesURL.Grouping_GroupingAreaColumnRight = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.grouping_area_column_right.png");
                    this.ImagesURL.Grouping_GroupingAreaColumnSpacer = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.grouping_area_column_spacer.png");
                    this.ImagesURL.PageNumber_Normal = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.page_number_normal.png");
                    this.ImagesURL.PageNumber_Selected = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.page_number_selected.png");
                    this.ImagesURL.ColumnsFooter = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.summary.png");
                    this.ImagesURL.GroupFooter = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.group_summary.png");
                }
                this.UseEmbeddedImages = true;
            }
            else
            {
                this.ImagesURL.Header = "";
                this.ImagesURL.Header_Placeholder = "";
                this.ImagesURL.PageNavigation_First_Normal = this.ImagesPath + "/first_normal.gif";
                this.ImagesURL.PageNavigation_First_Over = this.ImagesPath + "/first_over.gif";
                this.ImagesURL.PageNavigation_First_Pressed = this.ImagesPath + "/first_pressed.gif";
                this.ImagesURL.PageNavigation_First_Disabled = this.ImagesPath + "/first_disabled.gif";
                this.ImagesURL.PageNavigation_Previous_Normal = this.ImagesPath + "/previous_normal.gif";
                this.ImagesURL.PageNavigation_Previous_Over = this.ImagesPath + "/previous_over.gif";
                this.ImagesURL.PageNavigation_Previous_Pressed = this.ImagesPath + "/previous_pressed.gif";
                this.ImagesURL.PageNavigation_Previous_Disabled = this.ImagesPath + "/previous_disabled.gif";
                this.ImagesURL.PageNavigation_Next_Normal = this.ImagesPath + "/next_normal.gif";
                this.ImagesURL.PageNavigation_Next_Over = this.ImagesPath + "/next_over.gif";
                this.ImagesURL.PageNavigation_Next_Pressed = this.ImagesPath + "/next_pressed.gif";
                this.ImagesURL.PageNavigation_Next_Disabled = this.ImagesPath + "/next_disabled.gif";
                this.ImagesURL.PageNavigation_Last_Normal = this.ImagesPath + "/last_normal.gif";
                this.ImagesURL.PageNavigation_Last_Over = this.ImagesPath + "/last_over.gif";
                this.ImagesURL.PageNavigation_Last_Pressed = this.ImagesPath + "/last_pressed.gif";
                this.ImagesURL.PageNavigation_Last_Disabled = this.ImagesPath + "/last_disabled.gif";
                this.ImagesURL.PageNavigation_First_Normal_Top = this.ImagesPath + "/first_normal_top.gif";
                this.ImagesURL.PageNavigation_First_Over_Top = this.ImagesPath + "/first_over_top.gif";
                this.ImagesURL.PageNavigation_First_Pressed_Top = this.ImagesPath + "/first_pressed_top.gif";
                this.ImagesURL.PageNavigation_First_Disabled_Top = this.ImagesPath + "/first_disabled_top.gif";
                this.ImagesURL.PageNavigation_Previous_Normal_Top = this.ImagesPath + "/previous_normal_top.gif";
                this.ImagesURL.PageNavigation_Previous_Over_Top = this.ImagesPath + "/previous_over_top.gif";
                this.ImagesURL.PageNavigation_Previous_Pressed_Top = this.ImagesPath + "/previous_pressed_top.gif";
                this.ImagesURL.PageNavigation_Previous_Disabled_Top = this.ImagesPath + "/previous_disabled_top.gif";
                this.ImagesURL.PageNavigation_Next_Normal_Top = this.ImagesPath + "/next_normal_top.gif";
                this.ImagesURL.PageNavigation_Next_Over_Top = this.ImagesPath + "/next_over_top.gif";
                this.ImagesURL.PageNavigation_Next_Pressed_Top = this.ImagesPath + "/next_pressed_top.gif";
                this.ImagesURL.PageNavigation_Next_Disabled_Top = this.ImagesPath + "/next_disabled_top.gif";
                this.ImagesURL.PageNavigation_Last_Normal_Top = this.ImagesPath + "/last_normal_top.gif";
                this.ImagesURL.PageNavigation_Last_Over_Top = this.ImagesPath + "/last_over_top.gif";
                this.ImagesURL.PageNavigation_Last_Pressed_Top = this.ImagesPath + "/last_pressed_top.gif";
                this.ImagesURL.PageNavigation_Last_Disabled_Top = this.ImagesPath + "/last_disabled_top.gif";
                this.ImagesURL.Sorting_Asc = this.ImagesPath + "/asc.gif";
                this.ImagesURL.Sorting_Desc = this.ImagesPath + "/desc.gif";
                this.ImagesURL.Placeholder = this.ImagesPath + "/placeholder.gif";
                this.ImagesURL.PlaceholderEmpty = this.ImagesPath + "/placeholder_empty.gif";
                this.ImagesURL.Grouping_BtnClose = this.ImagesPath + "/group_btn_close.gif";
                this.ImagesURL.Grouping_BtnOpen = this.ImagesPath + "/group_btn_open.gif";
                this.ImagesURL.Grouping_GroupingArea = "";
                this.ImagesURL.Grouping_RecordGroupHeader = "";
                this.ImagesURL.Filtering_ShowCriterias = this.ImagesPath + "/filter_criterias.gif";
                this.ImagesURL.Footer_Content = "";
                this.ImagesURL.Details_BtnClose = this.ImagesPath + "/details_btn_close.gif";
                this.ImagesURL.Details_BtnOpen = this.ImagesPath + "/details_btn_open.gif";
                this.UseEmbeddedImages = false;
            }
        }

        protected virtual EventHandler GetInsertCommand()
        {
            return this.InsertCommand;
        }

        internal virtual string GetInterfaceFolderStyle_DropDownList()
        {
            if (string.IsNullOrEmpty(this.FolderStyle))
            {
                return string.Empty;
            }
            if (string.IsNullOrEmpty(this.CssSettings.CSSFolderImages))
            {
                return (this.FolderStyle + "/interface/VdcDropDownList");
            }
            return (this.CSSFolderImages + "/interface/VdcDropDownList");
        }

        internal virtual string GetInterfaceFolderStyle_TextBox()
        {
            if (string.IsNullOrEmpty(this.FolderStyle))
            {
                return string.Empty;
            }
            if (string.IsNullOrEmpty(this.CssSettings.CSSFolderImages))
            {
                return (this.FolderStyle + "/interface/VdcTextBox");
            }
            return (this.CSSFolderImages + "/interface/VdcTextBox");
        }

        private string GetItemFromCollection(NameValueCollection collection, string key)
        {
            string str = key.Substring(key.LastIndexOf("ob_") + 3) + "__";
            for (int i = 0; i < collection.Count; i++)
            {
                string str2 = collection.GetKey(i);
                if (!string.IsNullOrEmpty(str2) && ((str2.ToString() + "__").IndexOf(str) != -1))
                {
                    return collection.Get(i).ToString();
                }
            }
            return null;
        }

        internal virtual int GetLevelInHierarchy()
        {
            return 0;
        }

        protected virtual string GetMainContainerWidth()
        {
            if (!(this.ScrollingSettings.ScrollWidth != Unit.Pixel(0)))
            {
                return this.Width.ToString();
            }
            return this.ScrollingSettings.ScrollWidth.ToString();
        }

        internal virtual string GetMultiPageGroupsInformation(int index, string dataField)
        {
            int[] numArray = new int[4];
            numArray = this.CheckMultiPageGroupOfRecords(index, dataField);
            if (numArray[0] != 0)
            {
                if (((numArray[3] != 0) && (numArray[2] == 0)) && this.ShowMultiPageGroupsInfo)
                {
                    return this.LocalizationSettings.Grouping_GroupInformationNextPage.Replace("XXXXX", numArray[0].ToString()).Replace("YYYYY", numArray[1].ToString());
                }
                if (((numArray[3] == 0) && (numArray[2] != 0)) && this.ShowMultiPageGroupsInfo)
                {
                    return this.LocalizationSettings.Grouping_GroupInformationPreviousPage.Replace("XXXXX", numArray[0].ToString()).Replace("YYYYY", numArray[1].ToString());
                }
                if (((numArray[3] != 0) && (numArray[2] != 0)) && this.ShowMultiPageGroupsInfo)
                {
                    return this.LocalizationSettings.Grouping_GroupInformationPreviousNextPage.Replace("XXXXX", numArray[0].ToString()).Replace("YYYYY", numArray[1].ToString());
                }
                if (this.ShowGroupsInfo)
                {
                    if (numArray[0] != 1)
                    {
                        return this.LocalizationSettings.Grouping_GroupInformationCount.Replace("XXXXX", numArray[0].ToString());
                    }
                    return this.LocalizationSettings.Grouping_GroupInformationCountSingle.Replace("XXXXX", numArray[0].ToString());
                }
                return "";
            }
            return "";
        }

        internal int GetNumberOfVisibleColumns()
        {
            int num = 0;
            foreach (Column column in this.Columns)
            {
                if (column.Visible)
                {
                    num++;
                }
            }
            return num;
        }

        protected virtual string GetPageSelectorID()
        {
            return ("ob_" + this.GridID + "PageSelector");
        }

        internal virtual int GetPageSize(bool getMaxSize)
        {
            return this.GetPageSize(getMaxSize, false);
        }

        protected virtual int GetPageSize(bool getMaxSize, bool getZeroValue)
        {
            if (this.PageSize == -1)
            {
                if (getZeroValue)
                {
                    return 0;
                }
                if (getMaxSize)
                {
                    return 0x77359400;
                }
            }
            return this.PageSize;
        }

        internal virtual string GetPageSizeSelectorID()
        {
            return ("ob_" + this.GridID + "PageSizeSelector");
        }

        protected virtual DefaultEventHandler GetRebindEventHandler()
        {
            return this.Rebind;
        }

        internal virtual Vdc.Grid.Grid GetRootMasterGrid()
        {
            return this;
        }

        protected virtual string GetSelectedRecordsContainerID()
        {
            return ("ob_" + this.GridID + "SelectedRecordsContainer");
        }

        protected virtual string GetSelectedRecordsIndexesContainerID()
        {
            return ("ob_" + this.GridID + "SelectedRecordsIndexes");
        }

        protected virtual EventHandler GetSelectEventHandler()
        {
            return this.Select;
        }

        protected virtual string GetSerializedColumnsContainerID()
        {
            return ("ob_" + this.GridID + "SerializedCols");
        }

        private string GetSortExpression()
        {
            this.Cols.SortBySortPriority();
            if (this.SortExpression != string.Empty)
            {
                foreach (Column column in this.Cols)
                {
                    if (column.DataField == this.SortExpression)
                    {
                        if (this.SortOrder == "Asc")
                        {
                            column.SortOrder = SortOrderType.Asc;
                        }
                        else if (this.SortOrder == "Desc")
                        {
                            column.SortOrder = SortOrderType.Desc;
                        }
                        break;
                    }
                }
            }
            string str = "";
            foreach (Column column2 in this.Cols)
            {
                if (column2.DataField != string.Empty)
                {
                    if (column2.SortOrder != SortOrderType.None)
                    {
                        if (str != string.Empty)
                        {
                            str = str + ",";
                        }
                        string str2 = string.IsNullOrEmpty(column2.SortExpression) ? column2.DataField : column2.SortExpression;
                        str = str + str2 + " " + column2.SortOrder.ToString().ToUpper();
                    }
                    if ((this.AllowGrouping && (column2.DataField == this.GroupBy)) && (column2.RealSortOrder != column2.SortOrder))
                    {
                        column2.SortOrder = column2.RealSortOrder;
                    }
                }
            }
            this.Cols.Sort();
            return str;
        }

        private void GetStyleSheetPath()
        {
            if (this.FolderStyle != string.Empty)
            {
                this.CSSPath = Path.Combine(this.FolderStyle, "style.css");
                this.CSSPath = this.CSSPath.Replace(@"\", "/");
                if (this.CSSPath.IndexOf("~") == 0)
                {
                    if (!this.IsDesignTimeRender)
                    {
                        this.CSSPath = base.ResolveUrl(this.CSSPath);
                    }
                    else
                    {
                        try
                        {
                            string pathToActiveFile = GridIOHelper.GetPathToActiveFile(this);
                            string relativePathToProject = GridIOHelper.GetRelativePathToProject(this, this.FolderStyle);
                            this.CSSPath = GridIOHelper.EvaluateRelativePath(pathToActiveFile, relativePathToProject, "folder with styles");
                            this.CSSPath = Path.Combine(this.CSSPath, "style.css");
                            this.CSSPath = this.CSSPath.Replace(@"\", "/");
                        }
                        catch (Exception exception1)
                        {
                            if (exception1 != null)
                            {
                            }
                        }
                    }
                }
            }
            else
            {
                this.CSSPath = this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.styles.black_glass.style.css");
            }
        }

        internal string[] GetTemplatesIds()
        {
            string[] strArray = new string[this.Templates.Count];
            int index = 0;
            foreach (GridTemplate template in this.Templates)
            {
                strArray[index] = template.ID;
                index++;
            }
            return strArray;
        }

        internal virtual string GetTopPageSizeSelectorID()
        {
            return ("ob_" + this.GridID + "PageSizeSelector_Top");
        }

        protected virtual EventHandler GetUpdateCommand()
        {
            return this.UpdateCommand;
        }

        protected virtual string GetViewStateContainerID()
        {
            return ("ob_" + this.GridID + "ViewstateContainer");
        }

        protected virtual bool HasTriggeredCallback()
        {
            if (this.IsCallback)
            {
                return true;
            }
            if ((this.AvailableDetailGrids != null) && (this.AvailableDetailGrids.Count > 0))
            {
                foreach (DictionaryEntry entry in this.AvailableDetailGrids)
                {
                    Vdc.Grid.Grid grid = entry.Value as Vdc.Grid.Grid;
                    if (grid.HasTriggeredCallback())
                    {
                        return true;
                    }
                }
            }
            return false;
        }

        protected virtual void InitializeCommandsParametersContainer()
        {
            this.commandsParametersContainer = new GridRenderContainer();
            this.commandsParametersContainer.ID = this.GridID + "CommandContainer";
            this.commandsParametersContainer.Style["display"] = "none";
        }

        private void InitializeParameters(IEnumerable dataSource, bool dataBinding)
        {
            this.pagedDataSource = null;
            this.dataItem = null;
            this.rowIndex = 0;
            this.dataRows.Clear();
            this.internalDataSource = dataSource;
            this.internalDataBinding = dataBinding;
            this.mainContainer = null;
            this.secondMainContainer = null;
            this.headerTable = null;
            this.bodyTable = null;
            this.footerTable = null;
            this.copyrightMessageStart = null;
            this.copyrightMessageEnd = null;
            this.gridObjectInformationStart = null;
            this.gridObjectInformationEnd = null;
            this.evaluationExpired = false;
            this.displayHtmlMarkup = true;
            this.elementsClientIds = new GridElementsClientIds();
            this.cellTemplates = new ArrayList();
            if (this.AllowFiltering)
            {
                this.filterTemplates = new ArrayList();
                this.filterOptionsTemplates = new ArrayList();
            }
            if (this.AllowRecordSelection)
            {
                this.selectedRowsIndexes = "";
            }
            if (this.AllowGrouping)
            {
                this.previouslyGroupedValues = new Hashtable();
            }
            this.recordStyleDisplay = "";
            this.customDataRowsNumber = 0;
        }

        protected virtual bool InsertOperationCallback(int affectedRows, Exception ex)
        {
            this.OnRebind();
            return true;
        }

        public virtual void InsertRow(GridRecordEventArgs args)
        {
            DataSourceView data = this.GetData();
            if (this.GetInsertCommand() != null)
            {
                this.OnInsertCommand(args);
            }
            else if (data.CanInsert)
            {
                IDataSource dataSource = this.GetDataSource();
                if (args.Record != null)
                {
                    ParameterCollection insertParameters = null;
                    if (dataSource is SqlDataSource)
                    {
                        insertParameters = (dataSource as SqlDataSource).InsertParameters;
                    }
                    else if (dataSource is ObjectDataSource)
                    {
                        insertParameters = (dataSource as ObjectDataSource).InsertParameters;
                    }
                    Hashtable values = new Hashtable();
                    if ((insertParameters != null) && (insertParameters.Count > 0))
                    {
                        foreach (Parameter parameter in insertParameters)
                        {
                            values.Add(parameter.Name, args.Record[parameter.Name]);
                        }
                    }
                    else
                    {
                        values = args.Record;
                    }
                    data.Insert(values, new DataSourceViewOperationCallback(this.InsertOperationCallback));
                }
                else if (args.RecordsCollection != null)
                {
                    int num = 0;
                    foreach (Hashtable hashtable2 in args.RecordsCollection)
                    {
                        if (num < (args.RecordsCollection.Count - 1))
                        {
                            data.Insert(hashtable2, new DataSourceViewOperationCallback(this.OperationDummyCallback));
                        }
                        else
                        {
                            data.Insert(hashtable2, new DataSourceViewOperationCallback(this.InsertOperationCallback));
                        }
                        num++;
                    }
                }
                this.StoreEventInformation("INSERT", args);
            }
        }

        public virtual bool IsInCallbackHierarchy()
        {
            return this.IsCallback;
        }

        internal bool IsSelectedRecord(Hashtable oRecord)
        {
            if (this.SelectedRecords != null)
            {
                bool flag = true;
                foreach (Hashtable hashtable in this.SelectedRecords)
                {
                    flag = true;
                    foreach (Column column in this.Columns)
                    {
                        if (column.DataField != "")
                        {
                            try
                            {
                                if ((hashtable[column.DataField] != null) && (hashtable[column.DataField].ToString().Replace("  ", " ") != oRecord[column.DataField].ToString().Replace("  ", " ")))
                                {
                                    flag = false;
                                    break;
                                }
                            }
                            catch (Exception exception1)
                            {
                                if (exception1 != null)
                                {
                                }
                            }
                        }
                    }
                    if (flag)
                    {
                        return true;
                    }
                }
            }
            return false;
        }

        protected virtual void LoadFilterCriterias(string encodedFilterExpression)
        {
            foreach (string str in this.SplitByString(encodedFilterExpression, this.ArrayElementsSeparator))
            {
                string[] strArray2 = this.SplitByString(str, this.ObjectPropertiesSeparator);
                Column columnByDataField = this.Columns.GetColumnByDataField(strArray2[0]);
                FilterCriteria criteria = new FilterCriteria();
                int result = 0;
                if (int.TryParse(strArray2[1], out result))
                {
                    criteria.Option = new FilterOption();
                    criteria.Option.Type = StandardFilterCriterias.GetFilterTypeByIndex(result);
                    criteria.Value = HttpUtility.UrlDecode(strArray2[2], Encoding.Default);
                }
                else
                {
                    CustomFilterOption filterOptionById = columnByDataField.GetFilterOptionById(strArray2[1]) as CustomFilterOption;
                    if (filterOptionById != null)
                    {
                        criteria.Option = filterOptionById;
                    }
                    criteria.Values = new Hashtable();
                    string[] strArray3 = filterOptionById.TemplateSettings.FilterControlsIds.Split(new char[] { ',' });
                    for (int i = 0; i < strArray3.Length; i++)
                    {
                        if (strArray2.Length > 2)
                        {
                            criteria.Values.Add(strArray3[i], HttpUtility.UrlDecode(strArray2[2 + i], Encoding.Default));
                        }
                        else
                        {
                            criteria.Values.Add(strArray3[i], "");
                        }
                    }
                }
                columnByDataField.FilterCriteria = criteria;
            }
        }

        private void LoadLanguage()
        {
            if ((this.Language != string.Empty) && !this.IsDesignTimeRender)
            {
                Localization localization = new Localization(this.FolderLocalization, this.Language, this.Page, false);
                XmlElement root = localization.root;
                try
                {
                    this.LocalizationSettings.TrackChanges = false;
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Paging_PageSizeText_Changed)
                    {
                        this.LocalizationSettings.Paging_PageSizeText = root.ChildNodes[0].Attributes["page_size_text"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Paging_RecordsText_Changed)
                    {
                        this.LocalizationSettings.Paging_RecordsText = root.ChildNodes[0].Attributes["records_text"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Paging_ToText_Changed)
                    {
                        this.LocalizationSettings.Paging_ToText = root.ChildNodes[0].Attributes["to_text"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Paging_OfText_Changed)
                    {
                        this.LocalizationSettings.Paging_OfText = root.ChildNodes[0].Attributes["of_text"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Paging_PagesText_Changed)
                    {
                        this.LocalizationSettings.Paging_PagesText = root.ChildNodes[0].Attributes["pages_text"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.LoadingText_Changed)
                    {
                        this.LocalizationSettings.LoadingText = root.ChildNodes[0].Attributes["loading_text"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.NoRecordsText_Changed)
                    {
                        this.LocalizationSettings.NoRecordsText = root.ChildNodes[0].Attributes["no_records_text"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.ResizingTooltipWidth_Changed)
                    {
                        this.LocalizationSettings.ResizingTooltipWidth = root.ChildNodes[0].Attributes["resizing_tooltip_width"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.ResizingTooltipPixels_Changed)
                    {
                        this.LocalizationSettings.ResizingTooltipPixels = root.ChildNodes[0].Attributes["resizing_tooltip_pixels"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.TypeValidationError_Changed)
                    {
                        this.LocalizationSettings.TypeValidationError = root.ChildNodes[0].Attributes["type_validation_error"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.MaxLengthValidationError_Changed)
                    {
                        this.LocalizationSettings.MaxLengthValidationError = root.ChildNodes[0].Attributes["maxlength_validation_error"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.JSWarning_Changed)
                    {
                        this.LocalizationSettings.JSWarning = root.ChildNodes[0].Attributes["js_warning"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.AddLink_Changed)
                    {
                        this.LocalizationSettings.AddLink = root.ChildNodes[0].ChildNodes[0].Attributes["add_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.EditLink_Changed)
                    {
                        this.LocalizationSettings.EditLink = root.ChildNodes[0].ChildNodes[0].Attributes["edit_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.DeleteLink_Changed)
                    {
                        this.LocalizationSettings.DeleteLink = root.ChildNodes[0].ChildNodes[0].Attributes["delete_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.UpdateLink_Changed)
                    {
                        this.LocalizationSettings.UpdateLink = root.ChildNodes[0].ChildNodes[0].Attributes["update_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.CancelLink_Changed)
                    {
                        this.LocalizationSettings.CancelLink = root.ChildNodes[0].ChildNodes[0].Attributes["cancel_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.SaveLink_Changed)
                    {
                        this.LocalizationSettings.SaveLink = root.ChildNodes[0].ChildNodes[0].Attributes["save_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.SaveAllLink_Changed)
                    {
                        this.LocalizationSettings.SaveAllLink = root.ChildNodes[0].ChildNodes[0].Attributes["save_all_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.CancelAllLink_Changed)
                    {
                        this.LocalizationSettings.CancelAllLink = root.ChildNodes[0].ChildNodes[0].Attributes["cancel_all_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.RemoveLink_Changed)
                    {
                        this.LocalizationSettings.RemoveLink = root.ChildNodes[0].ChildNodes[0].Attributes["remove_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.ModifyLink_Changed)
                    {
                        this.LocalizationSettings.ModifyLink = root.ChildNodes[0].ChildNodes[0].Attributes["modify_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.UndeleteLink_Changed)
                    {
                        this.LocalizationSettings.UndeleteLink = root.ChildNodes[0].ChildNodes[0].Attributes["undelete_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Filter_ShowLink_Changed)
                    {
                        this.LocalizationSettings.Filter_ShowLink = root.ChildNodes[0].ChildNodes[1].Attributes["button_show_filter"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Filter_HideLink_Changed)
                    {
                        this.LocalizationSettings.Filter_HideLink = root.ChildNodes[0].ChildNodes[1].Attributes["button_hide_filter"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Filter_ApplyLink_Changed)
                    {
                        this.LocalizationSettings.Filter_ApplyLink = root.ChildNodes[0].ChildNodes[1].Attributes["button_filter"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Filter_RemoveLink_Changed)
                    {
                        this.LocalizationSettings.Filter_RemoveLink = root.ChildNodes[0].ChildNodes[1].Attributes["button_remove_filter"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_NoFilter_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_NoFilter = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_nofilter"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_Contains_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_Contains = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_contains"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_DoesNotContain_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_DoesNotContain = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_does_not_contain"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_StartsWith_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_StartsWith = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_starts_with"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_EndsWith_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_EndsWith = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_ends_with"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_EqualTo_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_EqualTo = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_equal_to"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_NotEqualTo_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_NotEqualTo = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_not_equal_to"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_SmallerThan_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_SmallerThan = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_smaller_than"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_GreaterThan_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_GreaterThan = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_greater_than"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_SmallerThanOrEqualTo_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_SmallerThanOrEqualTo = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_smaller_than_or_equal_to"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_GreaterThanOrEqualTo_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_GreaterThanOrEqualTo = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_greater_than_or_equal_to"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_IsNull_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_IsNull = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_is_null"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_IsNotNull_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_IsNotNull = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_is_not_null"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_IsEmpty_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_IsEmpty = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_is_empty"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.FilterCriteria_IsNotEmpty_Changed)
                    {
                        this.LocalizationSettings.FilterCriteria_IsNotEmpty = root.ChildNodes[0].ChildNodes[1].Attributes["filter_criteria_is_not_empty"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Grouping_GroupingAreaText_Changed)
                    {
                        this.LocalizationSettings.Grouping_GroupingAreaText = root.ChildNodes[0].ChildNodes[2].Attributes["grouping_area_text"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Grouping_GroupInformationCount_Changed)
                    {
                        this.LocalizationSettings.Grouping_GroupInformationCount = root.ChildNodes[0].ChildNodes[2].Attributes["group_information_count"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Grouping_GroupInformationCountSingle_Changed)
                    {
                        this.LocalizationSettings.Grouping_GroupInformationCountSingle = root.ChildNodes[0].ChildNodes[2].Attributes["group_information_count_single"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Grouping_GroupInformationNextPage_Changed)
                    {
                        this.LocalizationSettings.Grouping_GroupInformationNextPage = root.ChildNodes[0].ChildNodes[2].Attributes["group_information_next_page"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Grouping_GroupInformationPreviousPage_Changed)
                    {
                        this.LocalizationSettings.Grouping_GroupInformationPreviousPage = root.ChildNodes[0].ChildNodes[2].Attributes["group_information_previous_page"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Grouping_GroupInformationPreviousNextPage_Changed)
                    {
                        this.LocalizationSettings.Grouping_GroupInformationPreviousNextPage = root.ChildNodes[0].ChildNodes[2].Attributes["group_information_previous_next_page"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Paging_TotalNumberOfPages_Changed)
                    {
                        this.LocalizationSettings.Paging_TotalNumberOfPages = root.ChildNodes[0].ChildNodes[3].Attributes["total_number_of_pages"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Paging_ManualPagingLink_Changed)
                    {
                        this.LocalizationSettings.Paging_ManualPagingLink = root.ChildNodes[0].ChildNodes[3].Attributes["manual_paging_link"].Value;
                    }
                    if (this.forceLanguageReloading && !this.LocalizationSettings.Paging_PageSizeOptions_All_Changed)
                    {
                        this.LocalizationSettings.Paging_PageSizeOptions_All = root.ChildNodes[0].ChildNodes[3].Attributes["page_size_options_all"].Value;
                    }
                    this.LocalizationSettings.TrackChanges = true;
                    this.forceLanguageReloading = false;
                }
                catch (Exception exception1)
                {
                    if (exception1 != null)
                    {
                    }
                    throw new Exception("There was a problem parsing the " + this.Language + ".xml file. Please make sure that you are using the correct xml file.");
                }
            }
        }

        public virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            string str12;
            if (!(this is DetailGrid))
            {
                this.RootGridPostDataKey = postDataKey;
                this.RootGridPostCollection = postCollection;
            }
            bool flag = false;
            this.IsPostBack = true;
            this._raiseSelectEvent = false;
            string str = postCollection["__ob_grid" + this.getId() + "IsCallback"];
            this.IsCallback = true;
            if (str == "1")
            {
                this.IsCallback = true;
            }
            else
            {
                this.IsCallback = false;
            }
            string str2 = postCollection["ob_" + this.getId() + "IsVirtualScrolling"];
            if (!string.IsNullOrEmpty(str2) && (str2 == "1"))
            {
                this._isVirtualScrolling = true;
            }
            else
            {
                this._isVirtualScrolling = false;
            }
            string str3 = postCollection["ob_" + this.getId() + "RGBoR"];
            if ((str3 != null) && (str3 == "1"))
            {
                this.RebindGrid();
            }
            string s = postCollection["ob_" + this.getId() + "RecordInEditMode"];
            if ((s != string.Empty) && (s != null))
            {
                this.RecordInEditMode = int.Parse(s, CultureInfo.InvariantCulture);
            }
            string str5 = postCollection["ob_" + this.getId() + "RecordInAddMode"];
            if ((str5 != string.Empty) && (str5 != null))
            {
                if (str5 == "1")
                {
                    this.RecordInAddMode = true;
                }
                else
                {
                    this.RecordInAddMode = false;
                }
            }
            if ((this.PageSelector != null) || (this is DetailGrid))
            {
                string itemFromCollection = this.GetItemFromCollection(postCollection, this.GetPageSelectorID());
                if (((itemFromCollection != null) && (itemFromCollection != string.Empty)) && (itemFromCollection != this.CurrentPageIndex.ToString()))
                {
                    this.OnPageChange(int.Parse(itemFromCollection, CultureInfo.InvariantCulture));
                }
            }
            if ((((this.footer != null) && (this.footer.PageSizeSelector != null)) || ((this.topFooter != null) && (this.topFooter.PageSizeSelector != null))) || (this is DetailGrid))
            {
                string str7 = this.GetItemFromCollection(postCollection, this.GetPageSizeSelectorID());
                string str8 = this.GetItemFromCollection(postCollection, this.GetTopPageSizeSelectorID());
                string str9 = "";
                if (!string.IsNullOrEmpty(str7))
                {
                    str9 = str7;
                }
                else
                {
                    str9 = str8;
                }
                if (!string.IsNullOrEmpty(str9) && (str9 != this.PageSize.ToString()))
                {
                    this.OnPageSizeChange(int.Parse(str9, CultureInfo.InvariantCulture));
                }
            }
            if ((this.SerializedColumnsContainer != null) || (this is DetailGrid))
            {
                string str10 = this.GetItemFromCollection(postCollection, this.GetSerializedColumnsContainerID());
                if (str10 != null)
                {
                    this.DeserializeColumnsCollection(HttpUtility.UrlDecode(str10, Encoding.Default));
                    flag = true;
                    this.sTempSerializedColumnsString = str10;
                }
            }
            if (this.AllowGrouping && flag)
            {
                this.GenerateGroupByExpression();
            }
            if ((this.ColumnsWidthContainer != null) || (this is DetailGrid))
            {
                string str11 = this.GetItemFromCollection(postCollection, this.GetColumnsWidthContainerID());
                if ((str11 != null) && (str11 != string.Empty))
                {
                    this.UpdateColumnsWidth = true;
                    this.ColumnsWidth = str11;
                }
            }
            if ((this.CellDivsWidthContainer != null) || (this is DetailGrid))
            {
                str12 = this.GetItemFromCollection(postCollection, this.GetCellDivsWidthContainerID());
            }
            else
            {
                str12 = "";
            }
            if ((str12 != null) && (str12 != string.Empty))
            {
                this.SetCellDivsWidth = true;
                this.CellDivsWidth = str12;
                this.arrCellDivsWidth = str12.Split(new char[] { ',' });
            }
            else
            {
                this.arrCellDivsWidth = new string[this.Cols.Count];
                for (int i = 0; i < this.Cols.Count; i++)
                {
                    this.arrCellDivsWidth[i] = "0";
                }
            }
            if (this.AllowFiltering && ((this.ClientFilterExpressionContainer != null) || (this is DetailGrid)))
            {
                string encodedFilterExpression = this.GetItemFromCollection(postCollection, this.GetClientFilterExpressionContainerID());
                if ((encodedFilterExpression != null) && (encodedFilterExpression != string.Empty))
                {
                    this.LoadFilterCriterias(encodedFilterExpression);
                }
                else
                {
                    this.FilterExpression = "";
                }
            }
            this._commandsToExecute = postCollection["ob_" + this.getId() + "ExecuteCommand"];
            this._parametersForCommandsToExecute = postCollection["ob_" + this.getId() + "CommandVariables"];
            string str14 = postCollection["ob_" + this.getId() + "EditTemplateMode"];
            string text1 = postCollection["ob_" + this.getId() + "sAddRecordMode"];
            if (str14 == "1")
            {
                string testString = postCollection["ob_" + this.getId() + "EditRecordValues"];
                if (testString != string.Empty)
                {
                    this.EditRecordValues = this.SplitByString(testString, this.CommandVariableSeparator);
                }
            }
            if (this.AllowRecordSelection && ((this.SelectedRecordsContainer != null) || (this is DetailGrid)))
            {
                string sSelectedRecordsString = this.GetItemFromCollection(postCollection, this.GetSelectedRecordsContainerID());
                if ((sSelectedRecordsString != null) && (sSelectedRecordsString != string.Empty))
                {
                    this.PopulateSelectedRecordsCollection(sSelectedRecordsString);
                    this.SelectedRecordsString = sSelectedRecordsString;
                    if (((this.GetSelectEventHandler() != null) && (this.NewSelectedRecords != null)) && (this.NewSelectedRecords.Count > 0))
                    {
                        this._selectEventArgs = new GridRecordEventArgs();
                        this._selectEventArgs.RecordsCollection = this.NewSelectedRecords;
                        this._raiseSelectEvent = true;
                    }
                }
            }
            string str17 = postCollection["ob_" + this.getId() + "VSC"];
            if ((str17 != null) && (str17 != string.Empty))
            {
                this.ColumnsVisibleStateContainerTempValue = str17;
            }
            if (this.AllowFiltering && (this.FilteringButtonsConfiguration != null))
            {
                string str18 = this.GetItemFromCollection(postCollection, this.FilteringButtonsConfiguration.ID);
                if (str18 != null)
                {
                    this.FilteringButtonsConfigurationValue = str18;
                }
            }
            if ((this.CallbackMode && this.Serialize) && (this.__ViewState == null))
            {
                string str19 = this.GetItemFromCollection(postCollection, this.GetViewStateContainerID());
                if (str19 != string.Empty)
                {
                    this.__ViewState = str19;
                    if (!this.IsCallback)
                    {
                        this.ViewStateChanged = true;
                    }
                }
            }
            string sExportInfo = postCollection["ob_" + this.getId() + "ExportInfo"];
            if ((sExportInfo != null) && (sExportInfo != string.Empty))
            {
                this.ParseExportInfo(sExportInfo);
                this.isExporting = true;
            }
            if (this.expandedMasterRowsContainer != null)
            {
                string str21 = this.GetItemFromCollection(postCollection, this.expandedMasterRowsContainer.ID);
                if (!string.IsNullOrEmpty(str21))
                {
                    this.ManageExpandedMasterRows(str21);
                }
            }
            if (this.DetailGrids.Count > 0)
            {
                Vdc.Grid.Grid rootMasterGrid = this.GetRootMasterGrid();
                string key = !(this is DetailGrid) ? this.ID : ((DetailGrid) this).SourceGridID;
                if (!this.ManageDetailGridIdsOnPostback.ContainsKey(key))
                {
                    rootMasterGrid.ManageDetailGridIdsOnPostback[key] = true;
                }
            }
            if ((this is DetailGrid) && this.IsCallback)
            {
                this.MarkParentHierarchyAsReloadingBranch();
            }
            return true;
        }

        protected override void LoadViewState(object savedState)
        {
            if (savedState != null)
            {
                object[] objArray = savedState as object[];
                if ((objArray != null) && (objArray.Length == 10))
                {
                    base.LoadViewState(objArray[0]);
                    if (objArray[1] != null)
                    {
                        ((IStateManager) this.ClientSideEvents).LoadViewState(objArray[1]);
                    }
                    if (objArray[2] != null)
                    {
                        ((IStateManager) this.CssSettings).LoadViewState(objArray[2]);
                    }
                    if (objArray[3] != null)
                    {
                        ((IStateManager) this.TemplateSettings).LoadViewState(objArray[3]);
                    }
                    if (objArray[4] != null)
                    {
                        ((IStateManager) this.Cols).LoadViewState(objArray[4]);
                    }
                    if (objArray[5] != null)
                    {
                        ((IStateManager) this.FilteringSettings).LoadViewState(objArray[5]);
                    }
                    if (objArray[6] != null)
                    {
                        ((IStateManager) this.GroupingSettings).LoadViewState(objArray[6]);
                    }
                    if (objArray[7] != null)
                    {
                        ((IStateManager) this.ExportingSettings).LoadViewState(objArray[7]);
                    }
                    if (objArray[8] != null)
                    {
                        ((IStateManager) this.PagingSettings).LoadViewState(objArray[8]);
                    }
                    if (objArray[9] != null)
                    {
                        ((IStateManager) this.AddEditDeleteSettings).LoadViewState(objArray[9]);
                    }
                }
            }
            else
            {
                base.LoadViewState(savedState);
            }
        }

        private void ManageCurrentPageIndex()
        {
            if (this.PageSize != -1)
            {
                if ((this.TotalRecords != 0) && ((this.CurrentPageIndex * this.GetPageSize(true)) > this.TotalRecords))
                {
                    this.CurrentPageIndex = this.TotalRecords / this.GetPageSize(true);
                }
                if (((this.CurrentPageIndex * this.GetPageSize(true)) == this.TotalRecords) && (this.CurrentPageIndex > 0))
                {
                    this.CurrentPageIndex--;
                }
            }
            else
            {
                this.CurrentPageIndex = 0;
            }
        }

        protected virtual void ManageExpandedMasterRows(string expandedMasterRows)
        {
            this.ArrMasterRowsForDetailGridToBeLoaded = new ArrayList();
            foreach (string str in this.SplitByString(expandedMasterRows, this.ArrayElementsSeparator))
            {
                this.ArrMasterRowsForDetailGridToBeLoaded.Add(this.CreateCommandEventArgs(HttpUtility.UrlDecode(str, Encoding.Default)));
            }
        }

        private void ManageGroupBy()
        {
            this.ArrGroupByColumns = new ArrayList();
            if (!string.IsNullOrEmpty(this.GroupBy))
            {
                string[] strArray = this.GroupBy.Split(new char[] { ',' });
                int num = 0;
                foreach (string str in strArray)
                {
                    for (int i = 0; i < this.Cols.Count; i++)
                    {
                        if ((this.Cols[i].DataField == str) && this.Cols[i].AllowGroupBy)
                        {
                            this.Cols[i].GroupBy = true;
                            this.Cols[i].RealSortOrder = this.Cols[i].SortOrder;
                            if (this.Cols[i].SortOrder == SortOrderType.None)
                            {
                                this.Cols[i].SortOrder = SortOrderType.Asc;
                            }
                            this.Cols[i].GroupByPriority = num;
                            this.Cols[i].SortPriority = num;
                            this.ArrGroupByColumns.Add(str);
                            num++;
                            if (this.HideColumnsWhenGrouping)
                            {
                                this.Cols[i].Visible = false;
                            }
                            break;
                        }
                    }
                }
            }
        }

        protected virtual void MarkParentHierarchyAsReloadingBranch()
        {
            this.IsInsideReloadingBranch = true;
        }

        protected virtual bool NeedsTopFooter()
        {
            if (((!this.AllowAddingRecords || ((this.AddEditDeleteSettings.AddLinksPosition != GridElementPosition.Top) && (this.AddEditDeleteSettings.AddLinksPosition != GridElementPosition.TopAndBottom))) && (!this.AllowPaging || ((this.PagingSettings.Position != GridElementPosition.Top) && (this.PagingSettings.Position != GridElementPosition.TopAndBottom)))) && ((!this.AllowPageSizeSelection || ((this.PagingSettings.PageSizeSelectorPosition != GridElementPosition.Top) && (this.PagingSettings.PageSizeSelectorPosition != GridElementPosition.TopAndBottom))) && (!this.AllowFiltering || ((this.FilteringSettings.FilterLinksPosition != GridElementPosition.Top) && (this.FilteringSettings.FilterLinksPosition != GridElementPosition.TopAndBottom)))))
            {
                return false;
            }
            return true;
        }

        protected virtual void OnColumnsCreated()
        {
            DefaultEventHandler handler = base.Events[ColumnsCreatedKey] as DefaultEventHandler;
            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }

        protected virtual void OnColumnsCreating()
        {
            DefaultEventHandler handler = base.Events[ColumnsCreatingKey] as DefaultEventHandler;
            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }

        internal virtual void OnDataSourceNeeded()
        {
            this.handleDataSourceFiltering = false;
            this.handleDataSourceSorting = false;
            this.handleDataSourceCount = false;
            this.handleDataSourcePaging = false;
            if (this.AllowFiltering)
            {
                this.SetFilterExpression(false, true);
            }
            if (this.AllowGrouping)
            {
                this.ManageGroupBy();
                this.groupingExpressionHandled = true;
            }
            GridDataSourceNeededEventHandler handler = base.Events[DataSourceNeededKey] as GridDataSourceNeededEventHandler;
            GridDataSourceNeededEventArgs e = new GridDataSourceNeededEventArgs(this, this.GetSortExpression(), this.FilterExpression, this.CurrentPageIndex * this.PageSize, this.PageSize) {
                ForeignKeysValues = this.GetForeignKeysDictionary()
            };
            if (handler != null)
            {
                handler(this, e);
            }
        }

        protected virtual void OnDeleteCommand(GridRecordEventArgs e)
        {
            EventHandler deleteCommand = this.GetDeleteCommand();
            if (deleteCommand != null)
            {
                try
                {
                    deleteCommand(this, e);
                }
                catch (Exception exception)
                {
                    if (string.IsNullOrEmpty(this.ClientSideEvents.OnClientCallbackError))
                    {
                        throw new Exception(exception.Message);
                    }
                    this.CallbackError = new GridCallbackError(exception.Message, GridCommandType.Delete, e.Record);
                    if (exception != null)
                    {
                        exception = null;
                    }
                }
                this.StoreEventInformation("DELETE", e);
            }
            this.OnRebind();
        }

        internal virtual void OnExported(Table exportedTable)
        {
            GridExportEventHandler handler = base.Events[ExportedKey] as GridExportEventHandler;
            if (handler != null)
            {
                handler(this, new GridExportEventArgs(exportedTable));
            }
        }

        internal virtual void OnExporting(Table exportedTable)
        {
            GridExportEventHandler handler = base.Events[ExportingKey] as GridExportEventHandler;
            if (handler != null)
            {
                handler(this, new GridExportEventArgs(exportedTable));
            }
        }

        internal virtual void OnFiltering()
        {
            System.EventHandler handler = base.Events[FilteringKey] as System.EventHandler;
            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }

        protected override void OnInit(EventArgs e)
        {
            this.MyScriptManager = new Vdc.Grid.ScriptManagerHelper(this);
            if (this is DetailGrid)
            {
                this.additionalClientScripts = new ArrayList();
            }
            base.OnInit(e);
        }

        protected virtual void OnInsertCommand(GridRecordEventArgs e)
        {
            EventHandler insertCommand = this.GetInsertCommand();
            if (insertCommand != null)
            {
                try
                {
                    insertCommand(this, e);
                }
                catch (Exception exception)
                {
                    if (string.IsNullOrEmpty(this.ClientSideEvents.OnClientCallbackError))
                    {
                        throw new Exception(exception.Message);
                    }
                    this.CallbackError = new GridCallbackError(exception.Message, GridCommandType.Insert, e.Record);
                    if (exception != null)
                    {
                        exception = null;
                    }
                }
                this.StoreEventInformation("INSERT", e);
            }
            this.OnRebind();
        }

        protected override void OnLoad(EventArgs e)
        {
            this.Page.RegisterRequiresPostBack(this);
            if (!this.Page.IsPostBack)
            {
                this.CheckDataSourceNeeded();
            }
            base.OnLoad(e);
        }

        protected virtual void OnPageChange(int iPageIndex)
        {
            this.CurrentPageIndex = iPageIndex;
        }

        protected virtual void OnPageSizeChange(int iPageSize)
        {
            this.PageSize = iPageSize;
        }

        protected override void OnPreRender(EventArgs e)
        {
            if (this.IsPostBack && this.NeedsRebindForStyleSheet)
            {
                this.CreateReferencesForAppearanceResources();
                this.NeedsRebindForStyleSheet = false;
            }
            if ((!this.CallbackMode || !this.IsCallback) && (!this.IsDesignTimeRender && !(this is DetailGrid)))
            {
                if (((this.childControlsCreatedCount == 0) || this.IsPostBack) || ((!this.ShowFooter && !(this is DetailGrid)) && ((this.DetailGrids.Count > 0) && (this.MasterDetailSettings.LoadingMode == DetailGridLoadingMode.OnCallback))))
                {
                    VdcDropDownList.RegisterClientScripts(this);
                    VdcTextBox.RegisterClientScripts(this);
                    foreach (Column column in this.Columns)
                    {
                        if (((column is CheckBoxColumn) && (((CheckBoxColumn) column).ControlType == GridControlType.Vdc)) || ((column is CheckBoxSelectColumn) && (((CheckBoxSelectColumn) column).ControlType == GridControlType.Vdc)))
                        {
                            VdcCheckBox.RegisterClientScripts(this);
                            break;
                        }
                    }
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcUtils"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcUtils", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcUtils.min.js"));
                    if (this.enableUnitTests)
                    {
                        this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_UnitTestManager", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts_tests.vdcGrid_UnitTestManager.min.js"));
                        this.MyScriptManager.RegisterClientScriptInclude("Test_vdcUtils", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts_tests.Test_vdcUtils.min.js"));
                    }
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid.min.js"));
                    if (this.enableUnitTests)
                    {
                        this.MyScriptManager.RegisterClientScriptInclude("Test_vdcGrid", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts_tests.Test_vdcGrid.min.js"));
                    }
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_HelperMethods"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_HelperMethods", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_HelperMethods.min.js"));
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_BrowserInterface"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_BrowserInterface", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_BrowserInterface.min.js"));
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_AJAX"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_AJAX", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_AJAX.min.js"));
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_Callbacks"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_Callbacks", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_Callbacks.min.js"));
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_LayoutInterface"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_LayoutInterface", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_LayoutInterface.min.js"));
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_MultiRecordCommands"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_MultiRecordCommands", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_MultiRecordCommands.min.js"));
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_RecordSelection"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_RecordSelection", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_RecordSelection.min.js"));
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_Scrolling"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_Scrolling", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_Scrolling.min.js"));
                }
                if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_ColumnResizing"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_ColumnResizing", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_ColumnResizing.min.js"));
                    if (this.enableUnitTests)
                    {
                        this.MyScriptManager.RegisterClientScriptInclude("Test_vdcGrid_ColumnResizing", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts_tests.Test_vdcGrid_ColumnResizing.min.js"));
                    }
                }
                if ((this.EnableTypeValidation || (!(this is DetailGrid) && (this.DetailGrids.Count > 0))) && !this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_TypeValidation"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_TypeValidation", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_TypeValidation.min.js"));
                }
                if ((this.AllowFiltering || (!(this is DetailGrid) && (this.DetailGrids.Count > 0))) && !this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_Filtering"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_Filtering", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_Filtering.min.js"));
                }
                if (((this.AllowGrouping || this.AllowColumnReordering) || (!(this is DetailGrid) && (this.DetailGrids.Count > 0))) && !this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_Grouping"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_Grouping", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_Grouping.min.js"));
                }
                if (this.AllowKeyNavigation || (!(this is DetailGrid) && (this.DetailGrids.Count > 0)))
                {
                    if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_KeyboardNavigation"))
                    {
                        this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_KeyboardNavigation", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_KeyboardNavigation.min.js"));
                    }
                    if (!this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_KeyboardNavigation_Keys"))
                    {
                        this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_KeyboardNavigation_Keys", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_KeyboardNavigation_Keys.min.js"));
                    }
                }
                if ((this.DetailGrids.Count > 0) && !this.MyScriptManager.IsClientScriptIncludeRegistered("vdcGrid_MasterDetail"))
                {
                    this.MyScriptManager.RegisterClientScriptInclude("vdcGrid_MasterDetail", this.Page.ClientScript.GetWebResourceUrl(typeof(Vdc.Grid.Grid), "Vdc.Grid.resources.scripts.vdcGrid_MasterDetail.min.js"));
                }
            }
            this.Page.ClientScript.GetCallbackEventReference(this, null, null, null, true);
            base.OnPreRender(e);
        }

        protected virtual void OnRebind()
        {
            DefaultEventHandler rebindEventHandler = this.GetRebindEventHandler();
            if (rebindEventHandler != null)
            {
                if (this.AllowRebinding)
                {
                    this.preventPreviousDataSourceClearing = true;
                    rebindEventHandler(this, new EventArgs());
                    this.preventPreviousDataSourceClearing = false;
                    this.NeedToApplyRebinding = false;
                }
                else
                {
                    this.NeedToApplyRebinding = true;
                }
            }
            else if (base.IsBoundUsingDataSourceID)
            {
                this.NeedToApplyRebinding = true;
            }
        }

        internal virtual void OnRowCreated(GridRowEventArgs e)
        {
            GridRowEventHandler handler = base.Events[RowCreatedKey] as GridRowEventHandler;
            if (handler != null)
            {
                handler(this, e);
            }
        }

        internal virtual void OnRowDataBound(GridRowEventArgs e)
        {
            GridRowEventHandler handler = base.Events[RowDataBoundKey] as GridRowEventHandler;
            if (handler != null)
            {
                handler(this, e);
            }
        }

        internal virtual void OnRowExported(TableRow row, GridRow sourceRow)
        {
            GridRowExportEventHandler handler = base.Events[RowExportedKey] as GridRowExportEventHandler;
            if (handler != null)
            {
                handler(this, new GridRowExportEventArgs(row, sourceRow));
            }
        }

        protected virtual void OnSelect(GridRecordEventArgs e)
        {
            EventHandler selectEventHandler = this.GetSelectEventHandler();
            if (selectEventHandler != null)
            {
                selectEventHandler(this, e);
            }
        }

        protected virtual void OnTemplatesCreated()
        {
            System.EventHandler handler = base.Events[TemplatesCreatedKey] as System.EventHandler;
            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }

        protected virtual void OnUpdateCommand(GridRecordEventArgs e)
        {
            EventHandler updateCommand = this.GetUpdateCommand();
            if (updateCommand != null)
            {
                try
                {
                    updateCommand(this, e);
                }
                catch (Exception exception)
                {
                    if (string.IsNullOrEmpty(this.ClientSideEvents.OnClientCallbackError))
                    {
                        throw new Exception(exception.Message);
                    }
                    this.CallbackError = new GridCallbackError(exception.Message, GridCommandType.Update, e.Record);
                    if (exception != null)
                    {
                        exception = null;
                    }
                }
                this.StoreEventInformation("UPDATE", e);
            }
            this.OnRebind();
        }

        protected bool OperationDummyCallback(int affectedRows, Exception ex)
        {
            return true;
        }

        private void ParseExportInfo(string sExportInfo)
        {
            string[] strArray = this.SplitByString(HttpUtility.UrlDecode(sExportInfo, Encoding.Default), this.ObjectPropertiesSeparator);
            this.exportType = strArray[0];
            if (!string.IsNullOrEmpty(strArray[4]))
            {
                this.ExportingSettings.AppendTimeStamp = bool.Parse(strArray[4]);
            }
            if (!string.IsNullOrEmpty(strArray[7]))
            {
                this.ExportingSettings.ColumnsToExport = strArray[7];
            }
            if (!string.IsNullOrEmpty(strArray[3]))
            {
                this.ExportingSettings.ExportAllPages = !bool.Parse(strArray[3]);
            }
            if (!string.IsNullOrEmpty(strArray[6]))
            {
                this.ExportingSettings.ExportHiddenColumns = bool.Parse(strArray[6]);
            }
            if (!string.IsNullOrEmpty(strArray[1]))
            {
                this.ExportingSettings.FileName = strArray[1];
            }
            if (!string.IsNullOrEmpty(strArray[2]))
            {
                this.ExportingSettings.KeepColumnSettings = bool.Parse(strArray[2]);
            }
            this.forceAllRecordsLoading = this.ExportingSettings.ExportAllPages;
            if (this.ExportingSettings.ExportAllPages)
            {
                this.PageSize = -1;
            }
        }

        protected override void PerformSelect()
        {
            if (base.IsBoundUsingDataSourceID)
            {
                try
                {
                    base.PerformSelect();
                }
                catch (Exception exception1)
                {
                    if (exception1 != null)
                    {
                    }
                    this.clearDataSourceSelectArgumentsSortExpression = true;
                    base.PerformSelect();
                }
            }
            else
            {
                base.PerformSelect();
            }
        }

        private void PopulateSelectedRecordsCollection(string sSelectedRecordsString)
        {
            this.SelectedRecords = new ArrayList();
            this.NewSelectedRecords = new ArrayList();
            this.MultiPageSelectionLoaded = true;
            foreach (string str in this.SplitByString(sSelectedRecordsString, this.ArrayElementsSeparator))
            {
                Hashtable hashtable = new Hashtable();
                string[] strArray2 = this.SplitByString(str, this.ObjectPropertiesSeparator);
                foreach (string str2 in this.SplitByString(strArray2[0], this.CommandVariableSeparator))
                {
                    string[] strArray4 = this.SplitByString(str2, this.CommandNameValueSeparator);
                    hashtable[HttpUtility.UrlDecode(strArray4[0], Encoding.Default)] = HttpUtility.UrlDecode(strArray4[1], Encoding.Default).Replace("<BR>", "\r\n");
                }
                this.SelectedRecords.Add(hashtable);
                if (strArray2[1] == "true")
                {
                    this.NewSelectedRecords.Add(hashtable);
                }
            }
        }

        private void PrepareExportInfo(string sExportInfo)
        {
            string[] strArray = this.SplitByString(HttpUtility.UrlDecode(sExportInfo, Encoding.Default), this.ObjectPropertiesSeparator);
            try
            {
                if (strArray[0] == "excel")
                {
                    if (strArray.Length == 8)
                    {
                        this.ExportToExcel(strArray[1], bool.Parse(strArray[2]), bool.Parse(strArray[3]), bool.Parse(strArray[4]), bool.Parse(strArray[5]), bool.Parse(strArray[6]), strArray[7]);
                    }
                    else
                    {
                        this.ExportToExcel(strArray[1], bool.Parse(strArray[2]), bool.Parse(strArray[3]), bool.Parse(strArray[4]), bool.Parse(strArray[5]));
                    }
                }
                else if (strArray[0] == "word")
                {
                    if (strArray.Length == 8)
                    {
                        this.ExportToWord(strArray[1], bool.Parse(strArray[2]), bool.Parse(strArray[3]), bool.Parse(strArray[4]), bool.Parse(strArray[5]), bool.Parse(strArray[6]), strArray[7]);
                    }
                    else
                    {
                        this.ExportToWord(strArray[1], bool.Parse(strArray[2]), bool.Parse(strArray[3]), bool.Parse(strArray[4]), bool.Parse(strArray[5]));
                    }
                }
            }
            catch (Exception exception1)
            {
                if (exception1 != null)
                {
                }
            }
        }

        protected virtual void RaiseCallbackEvent(string eventArgument)
        {
            new JavaScriptSerializer();
        }

        public void RaisePostBackEvent(string eventArgument)
        {
        }

        public void RaisePostDataChangedEvent()
        {
            if (this._raiseSelectEvent)
            {
                this.OnSelect(this._selectEventArgs);
            }
            if (((this._commandsToExecute == "DELETE") || (this._commandsToExecute == "UPDATE")) || ((this._commandsToExecute == "INSERT") || (this._commandsToExecute == "MULTIPLE")))
            {
                this.ExecuteCommands(this._commandsToExecute, this._parametersForCommandsToExecute);
            }
            this.AllowRebinding = true;
            this.isDuringRebinding = true;
            this.ExecuteRebinding(false);
            this.isDuringRebinding = false;
            this.BackupProperties();
            this.CheckDataSourceNeeded();
        }

        private byte[] ReadFullStream(Stream stream)
        {
            byte[] buffer2;
            byte[] buffer = new byte[0x1000];
            using (MemoryStream stream2 = new MemoryStream())
            {
                int num;
            Label_0011:
                num = 0;
                num = stream.Read(buffer, 0, buffer.Length);
                if (num <= 0)
                {
                    buffer2 = stream2.ToArray();
                }
                else
                {
                    stream2.Write(buffer, 0, num);
                    goto Label_0011;
                }
            }
            return buffer2;
        }

        private void RebindGrid()
        {
            this.OnRebind();
        }

        internal virtual void RemoveEmptyDetailGridFromMasterGrid()
        {
            Vdc.Grid.Grid masterGrid = ((DetailGrid) this).MasterGrid;
            GridRow masterRow = ((DetailGrid) this).MasterRow;
            if (masterGrid.MasterDetailSettings.LoadingMode == DetailGridLoadingMode.OnLoad)
            {
                try
                {
                    ((System.Web.UI.WebControls.Image) masterRow.Controls[0].Controls[0].Controls[0]).Style["display"] = "none";
                }
                catch (Exception exception1)
                {
                    if (exception1 != null)
                    {
                    }
                }
            }
            else
            {
                this.Controls.Clear();
                this.emptyDetailGridRemoved = true;
            }
        }

        private void RemoveExportedFiles()
        {
            DirectoryInfo info = new DirectoryInfo(HttpContext.Current.Server.MapPath(this.FolderExports));
            foreach (FileInfo info2 in info.GetFiles())
            {
                if ((info2.Extension.ToString() == ".xls") || (info2.Extension.ToString() == ".doc"))
                {
                    TimeSpan span = new TimeSpan(0, 0, 0, this.ExportingSettings.ExportedFilesLifeTime, 0);
                    if (info2.CreationTime < DateTime.Now.Subtract(span))
                    {
                        info2.Delete();
                    }
                }
            }
        }

        protected override void Render(HtmlTextWriter writer)
        {
            this.CheckIfNeedsEmptyDataSource();
            if (this.isExporting)
            {
                this.ExportToClient();
            }
            else
            {
                Vdc.Grid.Grid rootMasterGrid = this.GetRootMasterGrid();
                if ((!this.isExporting && this.CheckIfNeedsRebinding()) && this.IsPostBack)
                {
                    this.ExecuteRebinding(true);
                }
                GridHtmlTextWriter writer2 = new GridHtmlTextWriter(writer.InnerWriter, "");
                if ((this.Page != null) && !this.isExporting)
                {
                    this.Page.VerifyRenderingInServerForm(this);
                }
                if (!this.isExporting)
                {
                    this.UpdateEditTemplatesClientIdsReferences();
                    this.UpdatePostbackModeEditTemplatesClientIdsReferences();
                    if (this.AllowFiltering)
                    {
                        this.UpdateFilterTemplatesClientIdsReferences();
                        this.UpdateFilterOptionsTemplatesClientIdsReferences();
                    }
                    this.CreateElementsClientIdsContent();
                    if ((this is DetailGrid) && (this.scriptContainerForDetailGrid != null))
                    {
                        this.scriptContainerForDetailGrid.Text = this.CreateGridScript(true);
                    }
                }
                this.RenderContents(writer2);
                if (((((!this.isExporting && this.displayHtmlMarkup) && !this.IsDesignTimeRender) && (!this.CallbackMode || !this.IsCallback)) && ((!(this is DetailGrid) || !this.IsPostBack) || (this.IsInCallbackHierarchy() || !rootMasterGrid.HasTriggeredCallback()))) && (((this is DetailGrid) || (this.DetailGrids.Count <= 0)) || (!this.IsPostBack || !rootMasterGrid.HasTriggeredCallback())))
                {
                    if (!this.CheckAjaxPageInheritance() || ((this is DetailGrid) && !this.IsCallback))
                    {
                        this.MyScriptManager.RegisterStartupScript(this.ClientID, this.CreateGridScript(), true);
                    }
                    else
                    {
                        writer2.Write("<script type=\"text/javascript\">" + this.CreateGridScript() + "</script>");
                    }
                }
            }
        }

        private void RenderGroupingAreaColumns(HtmlTextWriter oWriter)
        {
            string[] strArray = this.GroupBy.Split(new char[] { ',' });
            for (int i = 0; i < strArray.Length; i++)
            {
                Column columnByDataField = this.Cols.GetColumnByDataField(strArray[i]);
                if ((columnByDataField != null) && columnByDataField.AllowGroupBy)
                {
                    if (i > 0)
                    {
                        oWriter.Write("<td>");
                        oWriter.Write("<div class=\"" + this.CssSettings.CSSGroupingAreaColumnSpacer + "\"></div>");
                        oWriter.Write("</td>");
                    }
                    oWriter.Write("<td>");
                    oWriter.Write("<div class=\"" + this.CssSettings.CSSGroupingAreaColumn + "\">" + GridEncodingHelper.XMLCdataEncode(columnByDataField.HeaderText) + "</div>");
                    if (!this.IsDesignTimeRender)
                    {
                        oWriter.Write("<div class=\"" + this.CssSettings.CSSData + "\">" + GridEncodingHelper.XMLCdataEncode(strArray[i]) + "</div>");
                    }
                    oWriter.Write("</td>");
                }
            }
        }

        private string RenderTemplate(HtmlTextWriter oWriter, string sTemplateId, string sValue, Hashtable oRowValues, object oDataObject, int iPageRecordIndex, int iRecordIndex)
        {
            GridTemplate byId = null;
            GridRuntimeTemplate runtimeTemplateById = null;
            if (this.Templates.GetById(sTemplateId) is GridRuntimeTemplate)
            {
                runtimeTemplateById = this.Templates.GetRuntimeTemplateById(sTemplateId);
                if (runtimeTemplateById == null)
                {
                    throw new InvalidTemplateIDException(sTemplateId);
                }
            }
            else
            {
                byId = this.Templates.GetById(sTemplateId);
                if (byId == null)
                {
                    throw new InvalidTemplateIDException(sTemplateId);
                }
            }
            string clientID = "";
            if (byId != null)
            {
                if (this.IsDesignTimeRender)
                {
                    byId.DataBind();
                }
                byId.Container.Value = sValue;
                byId.Container.DataItem = oRowValues;
                byId.Container.DataObject = oDataObject;
                byId.Container.PageRecordIndex = iPageRecordIndex;
                byId.Container.RecordIndex = iRecordIndex;
                byId.Container.GridClientID = this.GridID;
                byId.DataBind();
                byId.RenderControl(oWriter);
                clientID = byId.ClientID;
                if (!string.IsNullOrEmpty(this._templateSettings.RowEditTemplateId) && (this._templateSettings.RowEditTemplateId == sTemplateId))
                {
                    this.RowEditTemplate = byId;
                }
            }
            if (runtimeTemplateById != null)
            {
                if (runtimeTemplateById.Container == null)
                {
                    runtimeTemplateById.InstantiateTemplate();
                }
                runtimeTemplateById.Container.Value = sValue;
                runtimeTemplateById.Container.DataItem = oRowValues;
                runtimeTemplateById.Container.DataObject = oDataObject;
                runtimeTemplateById.Container.PageRecordIndex = iPageRecordIndex;
                runtimeTemplateById.Container.RecordIndex = iRecordIndex;
                runtimeTemplateById.Container.GridClientID = this.GridID;
                runtimeTemplateById.DataBind();
                runtimeTemplateById.RenderControl(oWriter);
                clientID = runtimeTemplateById.ClientID;
                if (!string.IsNullOrEmpty(this._templateSettings.RowEditTemplateId) && (this._templateSettings.RowEditTemplateId == sTemplateId))
                {
                    this.RowEditTemplate = runtimeTemplateById;
                }
            }
            return clientID;
        }

        private void ResizeColumns()
        {
            string[] strArray = this.ColumnsWidth.Split(new char[] { ',' });
            int index = 0;
            foreach (Column column in this.Columns)
            {
                if (index < strArray.Length)
                {
                    column.Width = strArray[index];
                }
                index++;
            }
        }

        protected override object SaveViewState()
        {
            object[] objArray = new object[10];
            objArray[0] = base.SaveViewState();
            if (this._clientSideEvents != null)
            {
                objArray[1] = ((IStateManager) this.ClientSideEvents).SaveViewState();
            }
            if (this._cssSettings != null)
            {
                objArray[2] = ((IStateManager) this.CssSettings).SaveViewState();
            }
            if (this._templateSettings != null)
            {
                objArray[3] = ((IStateManager) this.TemplateSettings).SaveViewState();
            }
            if (this.Cols != null)
            {
                objArray[4] = ((IStateManager) this.Cols).SaveViewState();
            }
            if (this.FilteringSettings != null)
            {
                objArray[5] = ((IStateManager) this.FilteringSettings).SaveViewState();
            }
            if (this.GroupingSettings != null)
            {
                objArray[6] = ((IStateManager) this.GroupingSettings).SaveViewState();
            }
            if (this.ExportingSettings != null)
            {
                objArray[7] = ((IStateManager) this.ExportingSettings).SaveViewState();
            }
            if (this.PagingSettings != null)
            {
                objArray[8] = ((IStateManager) this.PagingSettings).SaveViewState();
            }
            if (this.AddEditDeleteSettings != null)
            {
                objArray[9] = ((IStateManager) this.AddEditDeleteSettings).SaveViewState();
            }
            return objArray;
        }

        protected virtual void SerializeDataSource(IEnumerable enumerableDataSource)
        {
            bool flag = true;
            if ((!this.IsCallback && this.IsPostBack) && !string.IsNullOrEmpty(this.__ViewState))
            {
                flag = false;
            }
            if (flag)
            {
                DataView dv = enumerableDataSource as DataView;
                DataSet ds = this.ConvertDataViewToDataSet(dv);
                byte[] inArray = this.CompressDataSet(ds);
                if (inArray != null)
                {
                    if (!this.CallbackMode)
                    {
                        this.ViewState["DataSource"] = Convert.ToBase64String(inArray);
                    }
                    else
                    {
                        string str = Convert.ToBase64String(inArray);
                        if ((this.__ViewState != str) || !this.IsCallback)
                        {
                            this.ViewStateChanged = true;
                        }
                        this.__ViewState = str;
                    }
                }
            }
        }

        private void SetFilterExpression(bool applyConversion, bool allowOnFilteringEvent)
        {
            StringBuilder builder = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            string dataField = "";
            string str2 = "";
            string s = "";
            int num = 0;
            bool flag2 = false;
            bool flag3 = false;
            string str4 = "";
            foreach (Column column in this.Columns)
            {
                if (((!string.IsNullOrEmpty(column.DataField) && column.AllowFilter) && ((column.FilterCriteria.Option.Type != FilterOptionType.NoFilter) && !(column.FilterCriteria.Option is CustomFilterOption))) && ((!string.IsNullOrEmpty(column.FilterCriteria.Value) || ((column.FilterCriteria.Values != null) && (column.FilterCriteria.Values.Count > 0))) || (((column.FilterCriteria.Option.Type == FilterOptionType.IsNull) || (column.FilterCriteria.Option.Type == FilterOptionType.IsNotNull)) || ((column.FilterCriteria.Option.Type == FilterOptionType.IsEmpty) || (column.FilterCriteria.Option.Type == FilterOptionType.IsNotEmpty)))))
                {
                    bool flag = true;
                    dataField = column.DataField;
                    if (dataField.IndexOf(" ") != -1)
                    {
                        dataField = "[" + dataField + "]";
                    }
                    s = this.EncodeStringForFiltering(column.FilterCriteria.Value);
                    if ((!string.IsNullOrEmpty(column.Type) && (column.Type != "System.String")) && applyConversion)
                    {
                        if ((((column.FilterCriteria.Option.Type != FilterOptionType.EqualTo) && (column.FilterCriteria.Option.Type != FilterOptionType.NotEqualTo)) && ((column.FilterCriteria.Option.Type != FilterOptionType.SmallerThan) && (column.FilterCriteria.Option.Type != FilterOptionType.GreaterThan))) && ((column.FilterCriteria.Option.Type != FilterOptionType.SmallerThanOrEqualTo) && (column.FilterCriteria.Option.Type != FilterOptionType.GreaterThanOrEqualTo)))
                        {
                            dataField = "CONVERT(" + dataField + ", 'System.String')";
                        }
                        else if (column.Type == "System.DateTime")
                        {
                            flag2 = true;
                            try
                            {
                                DateTime.Parse(s, CultureInfo.InvariantCulture);
                            }
                            catch (Exception exception1)
                            {
                                if (exception1 != null)
                                {
                                }
                                flag2 = false;
                                flag = false;
                            }
                            if (flag2)
                            {
                                dataField = "CONVERT(" + dataField + ", 'System.DateTime')";
                            }
                        }
                        else
                        {
                            flag3 = true;
                            try
                            {
                                long.Parse(s, CultureInfo.InvariantCulture);
                            }
                            catch (Exception exception4)
                            {
                                if (exception4 != null)
                                {
                                }
                                try
                                {
                                    double.Parse(s, CultureInfo.InvariantCulture);
                                }
                                catch (Exception exception5)
                                {
                                    if (exception5 != null)
                                    {
                                    }
                                    flag3 = false;
                                    flag = false;
                                }
                            }
                            if (flag3)
                            {
                                dataField = "CONVERT(" + dataField + ", 'System.Double')";
                            }
                        }
                    }
                    if (flag3)
                    {
                        str4 = s;
                    }
                    else if (flag2)
                    {
                        str4 = "#" + s + "#";
                    }
                    else
                    {
                        str4 = "'" + s + "'";
                    }
                    switch (column.FilterCriteria.Option.Type)
                    {
                        case FilterOptionType.Contains:
                            str2 = " LIKE '%" + s + "%'";
                            break;

                        case FilterOptionType.DoesNotContain:
                            str2 = " NOT LIKE '%" + s + "%'";
                            break;

                        case FilterOptionType.StartsWith:
                            str2 = " LIKE '" + s + "%'";
                            break;

                        case FilterOptionType.EndsWith:
                            str2 = " LIKE '%" + s + "'";
                            break;

                        case FilterOptionType.EqualTo:
                            str2 = " = '" + s + "'";
                            break;

                        case FilterOptionType.NotEqualTo:
                            str2 = " <> '" + s + "'";
                            break;

                        case FilterOptionType.SmallerThan:
                            str2 = " < " + str4;
                            break;

                        case FilterOptionType.GreaterThan:
                            str2 = " > " + str4;
                            break;

                        case FilterOptionType.SmallerThanOrEqualTo:
                            str2 = " <= " + str4;
                            break;

                        case FilterOptionType.GreaterThanOrEqualTo:
                            str2 = " >= " + str4;
                            break;

                        case FilterOptionType.IsNull:
                            str2 = " IS NULL";
                            break;

                        case FilterOptionType.IsNotNull:
                            str2 = " IS NOT NULL";
                            break;

                        case FilterOptionType.IsEmpty:
                            str2 = " LIKE ''";
                            break;

                        case FilterOptionType.IsNotEmpty:
                            str2 = " NOT LIKE ''";
                            break;
                    }
                    if (flag)
                    {
                        column.FilterCriteria.FilterExpression = dataField + str2;
                        num++;
                    }
                    else
                    {
                        column.FilterCriteria.FilterExpression = "";
                    }
                    continue;
                }
                column.FilterCriteria.FilterExpression = "";
                if (column.FilterCriteria.Option is CustomFilterOption)
                {
                    num++;
                }
            }
            if (allowOnFilteringEvent && (num > 0))
            {
                this.OnFiltering();
            }
            num = 0;
            foreach (Column column2 in this.Columns)
            {
                if ((!string.IsNullOrEmpty(column2.DataField) && column2.AllowFilter) && !string.IsNullOrEmpty(column2.FilterCriteria.FilterExpression))
                {
                    if (num > 0)
                    {
                        if (this.FilteringSettings.MatchingType == GridFilterMatchingType.AllFilters)
                        {
                            builder.Append(" AND ");
                        }
                        else
                        {
                            builder.Append(" OR ");
                        }
                        builder2.Append(this.ArrayElementsSeparator);
                    }
                    builder.Append("(" + column2.FilterCriteria.FilterExpression + ")");
                    builder2.Append(column2.DataField);
                    builder2.Append(this.ObjectPropertiesSeparator);
                    builder2.Append(column2.FilterCriteria.Option.GetID());
                    if (column2.FilterCriteria.Option is CustomFilterOption)
                    {
                        CustomFilterOption option = column2.FilterCriteria.Option as CustomFilterOption;
                        foreach (string str5 in option.TemplateSettings.FilterControlsIds.Split(new char[] { ',' }))
                        {
                            if (column2.FilterCriteria.Values.ContainsKey(str5))
                            {
                                builder2.Append(this.ObjectPropertiesSeparator);
                                builder2.Append(column2.FilterCriteria.Values[str5].ToString());
                            }
                        }
                    }
                    else
                    {
                        builder2.Append(this.ObjectPropertiesSeparator);
                        builder2.Append(column2.FilterCriteria.Value);
                    }
                    num++;
                }
            }
            this.FilterExpression = builder.ToString();
            this.SerializedFilterExpression = builder2.ToString();
        }

        internal void SetHashValueByDataField(Hashtable hash, string dataField, string value)
        {
            string str = dataField;
            foreach (DictionaryEntry entry in hash)
            {
                if (entry.Key.ToString().ToLower() == dataField.ToLower())
                {
                    str = entry.Key.ToString();
                    break;
                }
            }
            hash[str] = value;
        }

        private string[] SplitByString(string testString, string split)
        {
            int index = 0;
            int startIndex = 0;
            int[] numArray = new int[testString.Length + 1];
            while (startIndex < testString.Length)
            {
                int num3 = testString.IndexOf(split, startIndex);
                if (num3 != -1)
                {
                    numArray[index++] = num3;
                    startIndex = num3 + split.Length;
                }
                else
                {
                    startIndex = testString.Length;
                }
            }
            string[] strArray = new string[index + 1];
            if (index == 0)
            {
                strArray[0] = testString;
                return strArray;
            }
            index--;
            strArray[0] = testString.Substring(0, numArray[0]);
            for (int i = 0; i < index; i++)
            {
                strArray[i + 1] = testString.Substring(numArray[i] + split.Length, (numArray[i + 1] - numArray[i]) - split.Length);
            }
            strArray[index + 1] = testString.Substring(numArray[index] + split.Length);
            return strArray;
        }

        internal virtual void StoreEditTemplatesReferences(GridCellDivContainer template, Control control, int columnIndex, bool getClientID)
        {
            Hashtable hashtable = new Hashtable();
            hashtable["template"] = template;
            hashtable["control"] = control;
            hashtable["columnIndex"] = columnIndex;
            hashtable["getClientID"] = getClientID;
            this.cellTemplates.Add(hashtable);
        }

        protected void StoreEventInformation(string commandName, GridRecordEventArgs eventArgs)
        {
            if ((!this.AllowMultiRecordAdding || !this.AllowMultiRecordEditing) || !this.AllowMultiRecordDeleting)
            {
                this.CommandExecuted = commandName;
                this.CommandData = eventArgs;
            }
            else
            {
                if (this.CommandsExecuted == null)
                {
                    this.CommandsExecuted = new ArrayList();
                    this.CommandsData = new ArrayList();
                }
                this.CommandsExecuted.Add(commandName);
                this.CommandsData.Add(eventArgs);
            }
        }

        internal virtual void StoreFilterOptionsTemplatesReferences(HtmlContainer templateContainer, GridTemplate template, int columnIndex, string customFilterOptionId)
        {
            Hashtable hashtable = new Hashtable();
            hashtable["templateContainer"] = templateContainer;
            hashtable["template"] = template;
            hashtable["columnIndex"] = columnIndex;
            hashtable["customFilterOptionId"] = customFilterOptionId;
            this.filterOptionsTemplates.Add(hashtable);
            Column column = this.Columns[columnIndex];
            if (column.filterOptionsTemplateContainers == null)
            {
                column.filterOptionsTemplateContainers = new List<Hashtable>();
            }
            column.filterOptionsTemplateContainers.Add(hashtable);
        }

        internal virtual void StoreFilterTemplatesReferences(HtmlContainer template, Control control, int columnIndex)
        {
            Hashtable hashtable = new Hashtable();
            hashtable["template"] = template;
            hashtable["control"] = control;
            hashtable["columnIndex"] = columnIndex;
            this.filterTemplates.Add(hashtable);
        }

        internal virtual void StorePostbackModeEditTemplatesReferences(Control template, Control control, bool getClientID)
        {
            Hashtable hashtable = new Hashtable();
            hashtable["template"] = template;
            hashtable["control"] = control;
            hashtable["getClientID"] = getClientID;
            if (this.cellPostbackModeTemplates == null)
            {
                this.cellPostbackModeTemplates = new ArrayList();
            }
            this.cellPostbackModeTemplates.Add(hashtable);
        }

        string ICallbackEventHandler.GetCallbackResult()
        {
            return this.GetCallbackResult();
        }

        void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
        {
            this.RaiseCallbackEvent(eventArgument);
        }

        protected override void TrackViewState()
        {
            base.TrackViewState();
            if (this._clientSideEvents != null)
            {
                ((IStateManager) this.ClientSideEvents).TrackViewState();
            }
            if (this._cssSettings != null)
            {
                ((IStateManager) this.CssSettings).TrackViewState();
            }
            if (this._templateSettings != null)
            {
                ((IStateManager) this.TemplateSettings).TrackViewState();
            }
            if (this.Cols != null)
            {
                ((IStateManager) this.Cols).TrackViewState();
            }
            if (this.FilteringSettings != null)
            {
                ((IStateManager) this.FilteringSettings).TrackViewState();
            }
            if (this.GroupingSettings != null)
            {
                ((IStateManager) this.GroupingSettings).TrackViewState();
            }
            if (this.ExportingSettings != null)
            {
                ((IStateManager) this.ExportingSettings).TrackViewState();
            }
            if (this.PagingSettings != null)
            {
                ((IStateManager) this.PagingSettings).TrackViewState();
            }
            if (this.AddEditDeleteSettings != null)
            {
                ((IStateManager) this.AddEditDeleteSettings).TrackViewState();
            }
        }

        private void UpdateColumnsVisibleState(string sColumnsVisibleStateContainerTempValue)
        {
            string[] strArray = sColumnsVisibleStateContainerTempValue.Split(new char[] { ',' });
            int index = 0;
            foreach (Column column in this.Cols)
            {
                if (strArray[index] == "1")
                {
                    column.Visible = true;
                }
                else
                {
                    column.Visible = false;
                }
                index++;
            }
        }

        protected virtual void UpdateEditTemplatesClientIdsReferences()
        {
            if (this.cellTemplates != null)
            {
                for (int i = 0; i < this.cellTemplates.Count; i++)
                {
                    GridCellDivContainer container = (GridCellDivContainer) ((Hashtable) this.cellTemplates[i])["template"];
                    bool flag = (bool) ((Hashtable) this.cellTemplates[i])["getClientID"];
                    if ((container != null) && (container.Controls.Count > 1))
                    {
                        GridCellSpanContainer container2 = container.Controls[1] as GridCellSpanContainer;
                        GridCellSpanContainer container3 = container.Controls[2] as GridCellSpanContainer;
                        Control control = (Control) ((Hashtable) this.cellTemplates[i])["control"];
                        if (control is GridTemplate)
                        {
                            if (flag)
                            {
                                container2.Text = this.GetControlIDForTemplate(((GridTemplate) control).NamingContainer, ((GridTemplate) control).ControlID);
                            }
                            if (string.IsNullOrEmpty(((GridTemplate) control).ControlPropertyName))
                            {
                                ((GridTemplate) control).ControlPropertyName = this.GetControlPropertyNameForTemplate(((GridTemplate) control).NamingContainer, ((GridTemplate) control).ControlID);
                            }
                            container3.Text = ((GridTemplate) control).ControlPropertyName;
                            try
                            {
                                GridTemplate template = control as GridTemplate;
                                template.Container.ColumnIndex = (int) ((Hashtable) this.cellTemplates[i])["columnIndex"];
                            }
                            catch (Exception exception1)
                            {
                                if (exception1 != null)
                                {
                                }
                            }
                            if (!(this is DetailGrid))
                            {
                                continue;
                            }
                            try
                            {
                                control.DataBind();
                                continue;
                            }
                            catch
                            {
                                continue;
                            }
                        }
                        if (flag)
                        {
                            container2.Text = control.ClientID;
                        }
                    }
                }
            }
        }

        protected virtual void UpdateFilterOptionsTemplatesClientIdsReferences()
        {
            if (this.filterOptionsTemplates != null)
            {
                for (int i = 0; i < this.filterOptionsTemplates.Count; i++)
                {
                    HtmlContainer container = (HtmlContainer) ((Hashtable) this.filterOptionsTemplates[i])["templateContainer"];
                    if ((container != null) && (container.Controls.Count > 1))
                    {
                        HtmlContainer container2 = container.Controls[1] as HtmlContainer;
                        HtmlContainer container3 = container.Controls[2] as HtmlContainer;
                        GridTemplate template = (GridTemplate) ((Hashtable) this.filterOptionsTemplates[i])["template"];
                        string[] strArray = container2.Text.Split(new char[] { ',' });
                        if (template != null)
                        {
                            StringBuilder builder = new StringBuilder();
                            for (int j = 0; j < strArray.Length; j++)
                            {
                                if (j > 0)
                                {
                                    builder.Append(",");
                                }
                                builder.Append(this.GetControlIDForTemplate(template.NamingContainer, strArray[j]));
                            }
                            container2.Text = builder.ToString();
                            if (string.IsNullOrEmpty(container3.Text))
                            {
                                StringBuilder builder2 = new StringBuilder();
                                for (int k = 0; k < strArray.Length; k++)
                                {
                                    if (k > 0)
                                    {
                                        builder2.Append(",");
                                    }
                                    builder2.Append(this.GetControlPropertyNameForTemplate(template.NamingContainer, strArray[k]));
                                }
                                container3.Text = builder2.ToString();
                            }
                            template.Container.ColumnIndex = (int) ((Hashtable) this.filterOptionsTemplates[i])["columnIndex"];
                        }
                    }
                }
            }
        }

        protected virtual void UpdateFilterTemplatesClientIdsReferences()
        {
            if (this.filterTemplates != null)
            {
                for (int i = 0; i < this.filterTemplates.Count; i++)
                {
                    if (((HtmlContainer) ((Hashtable) this.filterTemplates[i])["template"]) != null)
                    {
                        Control control = (Control) ((Hashtable) this.filterTemplates[i])["control"];
                        int num2 = (int) ((Hashtable) this.filterTemplates[i])["columnIndex"];
                        if (control is GridTemplate)
                        {
                            this.Columns[num2].FilterControlID = this.GetControlIDForTemplate(((GridTemplate) control).NamingContainer, ((GridTemplate) control).ControlID);
                            if (string.IsNullOrEmpty(((GridTemplate) control).ControlPropertyName))
                            {
                                ((GridTemplate) control).ControlPropertyName = this.GetControlPropertyNameForTemplate(((GridTemplate) control).NamingContainer, ((GridTemplate) control).ControlID);
                            }
                            this.Columns[num2].FilterControlPropertyName = ((GridTemplate) control).ControlPropertyName;
                            try
                            {
                                control.DataBind();
                            }
                            catch
                            {
                            }
                        }
                    }
                }
            }
        }

        protected virtual bool UpdateOperationCallback(int affectedRows, Exception ex)
        {
            this.OnRebind();
            return true;
        }

        protected virtual void UpdatePostbackModeEditTemplatesClientIdsReferences()
        {
            if (this.cellPostbackModeTemplates != null)
            {
                for (int i = 0; i < this.cellPostbackModeTemplates.Count; i++)
                {
                    Control control = (Control) ((Hashtable) this.cellPostbackModeTemplates[i])["template"];
                    bool flag = (bool) ((Hashtable) this.cellPostbackModeTemplates[i])["getClientID"];
                    if ((control != null) && (control.Controls.Count == 5))
                    {
                        GridCellSpanContainer container = control.Controls[2] as GridCellSpanContainer;
                        GridCellSpanContainer container2 = control.Controls[3] as GridCellSpanContainer;
                        Control control2 = (Control) ((Hashtable) this.cellPostbackModeTemplates[i])["control"];
                        if (control2 is GridTemplate)
                        {
                            container.Text = this.GetControlIDForTemplate(((GridTemplate) control2).NamingContainer, ((GridTemplate) control2).ControlID);
                            if (string.IsNullOrEmpty(((GridTemplate) control2).ControlPropertyName))
                            {
                                ((GridTemplate) control2).ControlPropertyName = this.GetControlPropertyNameForTemplate(((GridTemplate) control2).NamingContainer, ((GridTemplate) control2).ControlID);
                            }
                            container2.Text = ((GridTemplate) control2).ControlPropertyName;
                        }
                        else if (flag)
                        {
                            container.Text = control2.ClientID;
                        }
                        else
                        {
                            container.Text = control2.ID;
                        }
                    }
                }
            }
        }

        public virtual void UpdateRow(GridRecordEventArgs args)
        {
            DataSourceView data = this.GetData();
            if (this.GetUpdateCommand() != null)
            {
                this.OnUpdateCommand(args);
            }
            else if (data.CanUpdate)
            {
                IDataSource dataSource = this.GetDataSource();
                if (args.Record != null)
                {
                    ParameterCollection updateParameters = null;
                    if (dataSource is SqlDataSource)
                    {
                        updateParameters = (dataSource as SqlDataSource).UpdateParameters;
                    }
                    else if (dataSource is ObjectDataSource)
                    {
                        updateParameters = (dataSource as ObjectDataSource).UpdateParameters;
                    }
                    Hashtable values = new Hashtable();
                    if ((updateParameters != null) && (updateParameters.Count > 0))
                    {
                        foreach (Parameter parameter in updateParameters)
                        {
                            values.Add(parameter.Name, args.Record[parameter.Name]);
                        }
                    }
                    else
                    {
                        values = args.Record;
                    }
                    data.Update(null, values, null, new DataSourceViewOperationCallback(this.UpdateOperationCallback));
                }
                else if (args.RecordsCollection != null)
                {
                    int num = 0;
                    foreach (Hashtable hashtable2 in args.RecordsCollection)
                    {
                        if (num < (args.RecordsCollection.Count - 1))
                        {
                            data.Update(null, hashtable2, null, new DataSourceViewOperationCallback(this.OperationDummyCallback));
                        }
                        else
                        {
                            data.Update(null, hashtable2, null, new DataSourceViewOperationCallback(this.UpdateOperationCallback));
                        }
                        num++;
                    }
                }
                this.StoreEventInformation("UPDATE", args);
            }
        }

        [Browsable(false)]
        public override string AccessKey
        {
            get
            {
                return base.AccessKey;
            }
            set
            {
                base.AccessKey = value;
            }
        }

        [Description("Property used to define the add/edit/delete settings for the Grid."), Bindable(true), Category("Add/Edit/Delete"), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerProperty)]
        public GridAddEditDeleteSettings AddEditDeleteSettings
        {
            get
            {
                return this.addEditDeleteSettings;
            }
            set
            {
                this.addEditDeleteSettings = value;
            }
        }

        [Bindable(true), Description("Enable adding new records."), Category("Add/Edit/Delete"), DefaultValue(true)]
        public bool AllowAddingRecords
        {
            get
            {
                object obj2 = this.ViewState["AllowAddingRecords"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["AllowAddingRecords"] == null) || (value != ((bool) this.ViewState["AllowAddingRecords"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowAddingRecords"] = value;
            }
        }

        [Category("Columns"), Bindable(true), DefaultValue(false), Description("Gets or sets a value indicating whether the column reordering feature is enabled.")]
        public bool AllowColumnReordering
        {
            get
            {
                object obj2 = this.ViewState["AllowColumnReordering"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                this.ViewState["AllowColumnReordering"] = value;
            }
        }

        [Bindable(true), Category("Columns"), DefaultValue(true), Description("Enable column resizing.")]
        public bool AllowColumnResizing
        {
            get
            {
                object obj2 = this.ViewState["AllowColumnResizing"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["AllowColumnResizing"] = value;
            }
        }

        [Bindable(true), Category("Data"), DefaultValue(true), Description("If true, the data from the grid can be accessed on the server-side.")]
        public bool AllowDataAccessOnServer
        {
            get
            {
                object obj2 = this.ViewState["AllowDataAccessOnServer"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["AllowDataAccessOnServer"] == null) || (value != ((bool) this.ViewState["AllowDataAccessOnServer"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowDataAccessOnServer"] = value;
            }
        }

        [Description("Enables/disables the Filtering feature."), Category("Filtering"), DefaultValue(false), Bindable(true)]
        public bool AllowFiltering
        {
            get
            {
                object obj2 = this.ViewState["AllowFiltering"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["AllowFiltering"] == null) || (value != ((bool) this.ViewState["AllowFiltering"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowFiltering"] = value;
            }
        }

        [Description("Enables the Grouping feature."), Category("Grouping"), DefaultValue(false), Bindable(true)]
        public bool AllowGrouping
        {
            get
            {
                object obj2 = this.ViewState["AllowGrouping"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["AllowGrouping"] == null) || (value != ((bool) this.ViewState["AllowGrouping"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowGrouping"] = value;
            }
        }

        [Bindable(true), DefaultValue(false), Category("Accessibility"), Description("Enables the Key Navigation feature.")]
        public bool AllowKeyNavigation
        {
            get
            {
                object obj2 = this.ViewState["AllowKeyNavigation"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["AllowKeyNavigation"] == null) || (value != ((bool) this.ViewState["AllowKeyNavigation"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowKeyNavigation"] = value;
            }
        }

        [Bindable(true), DefaultValue(false), Description("If true, the user will be able to navigate to any page by specifying its number in a textbox."), Category("Paging")]
        public bool AllowManualPaging
        {
            get
            {
                object obj2 = this.ViewState["AllowManualPaging"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["AllowManualPaging"] == null) || (value != ((bool) this.ViewState["AllowManualPaging"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowManualPaging"] = value;
            }
        }

        [Category("Add/Edit/Delete"), Description("Enables/disables the multi-record adding feature."), DefaultValue(false), Bindable(true)]
        public bool AllowMultiRecordAdding
        {
            get
            {
                object obj2 = this.ViewState["AllowMultiRecordAdding"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["AllowMultiRecordAdding"] == null) || (value != ((bool) this.ViewState["AllowMultiRecordAdding"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowMultiRecordAdding"] = value;
            }
        }

        [Bindable(true), Category("Add/Edit/Delete"), DefaultValue(false), Description("Enables/disables the multi-record deleting feature.")]
        public bool AllowMultiRecordDeleting
        {
            get
            {
                object obj2 = this.ViewState["AllowMultiRecordDeleting"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["AllowMultiRecordDeleting"] == null) || (value != ((bool) this.ViewState["AllowMultiRecordDeleting"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowMultiRecordDeleting"] = value;
            }
        }

        [Description("Enables/disables the multi-record editing feature."), Bindable(true), Category("Add/Edit/Delete"), DefaultValue(false)]
        public bool AllowMultiRecordEditing
        {
            get
            {
                object obj2 = this.ViewState["AllowMultiRecordEditing"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["AllowMultiRecordEditing"] == null) || (value != ((bool) this.ViewState["AllowMultiRecordEditing"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowMultiRecordEditing"] = value;
            }
        }

        [Description("If set to true, records will be selectable using CTRL+Click or drag and drop"), Bindable(true), Category("Selecting Records"), DefaultValue(true)]
        public bool AllowMultiRecordSelection
        {
            get
            {
                object obj2 = this.ViewState["AllowMultiRecordSelection"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["AllowMultiRecordSelection"] == null) || (value != ((bool) this.ViewState["AllowMultiRecordSelection"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowMultiRecordSelection"] = value;
            }
        }

        [Category("Paging"), Description("Show/Hide the Page Size Selector."), Bindable(true), DefaultValue(true)]
        public bool AllowPageSizeSelection
        {
            get
            {
                object obj2 = this.ViewState["AllowPageSizeSelection"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["AllowPageSizeSelection"] == null) || (value != ((bool) this.ViewState["AllowPageSizeSelection"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowPageSizeSelection"] = value;
            }
        }

        [Bindable(true), DefaultValue(true), Description("Show/Hide the buttons for changing the page."), Category("Paging")]
        public bool AllowPaging
        {
            get
            {
                object obj2 = this.ViewState["AllowPaging"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["AllowPaging"] == null) || (value != ((bool) this.ViewState["AllowPaging"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowPaging"] = value;
            }
        }

        [Description("If set to true, records will be selectable"), Bindable(true), Category("Selecting Records"), DefaultValue(true)]
        public bool AllowRecordSelection
        {
            get
            {
                object obj2 = this.ViewState["AllowRecordSelection"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["AllowRecordSelection"] == null) || (value != ((bool) this.ViewState["AllowRecordSelection"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowRecordSelection"] = value;
            }
        }

        [Bindable(true), Description("Enable the sorting feature."), Category("Sorting"), DefaultValue(true)]
        public bool AllowSorting
        {
            get
            {
                object obj2 = this.ViewState["AllowSorting"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["AllowSorting"] == null) || (value != ((bool) this.ViewState["AllowSorting"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AllowSorting"] = value;
            }
        }

        [Description("Enable/disable auto generation of columns."), Category("Columns"), Bindable(true), DefaultValue(true)]
        public bool AutoGenerateColumns
        {
            get
            {
                object obj2 = this.ViewState["AutoGenerateColumns"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["AutoGenerateColumns"] = value;
            }
        }

        [Bindable(true), Category("Selecting Records"), DefaultValue(false), Description("If true, the page will be posted back to the server when a record from the Grid is selected")]
        public bool AutoPostBackOnSelect
        {
            get
            {
                object obj2 = this.ViewState["AutoPostBackOnSelect"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["AutoPostBackOnSelect"] == null) || (value != ((bool) this.ViewState["AutoPostBackOnSelect"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["AutoPostBackOnSelect"] = value;
            }
        }

        [Browsable(false)]
        public override Color BackColor
        {
            get
            {
                return base.BackColor;
            }
            set
            {
                base.BackColor = value;
            }
        }

        [Browsable(false)]
        public override Color BorderColor
        {
            get
            {
                return base.BorderColor;
            }
            set
            {
                base.BorderColor = value;
            }
        }

        [Browsable(false)]
        public override System.Web.UI.WebControls.BorderStyle BorderStyle
        {
            get
            {
                return base.BorderStyle;
            }
            set
            {
                base.BorderStyle = value;
            }
        }

        [Browsable(false)]
        public override Unit BorderWidth
        {
            get
            {
                return base.BorderWidth;
            }
            set
            {
                base.BorderWidth = value;
            }
        }

        [Description("Enables/disables the callback mode"), Bindable(true), Category("Settings"), DefaultValue(true)]
        public bool CallbackMode
        {
            get
            {
                object obj2 = this.ViewState["CallbackMode"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["CallbackMode"] == null) || (value != ((bool) this.ViewState["CallbackMode"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["CallbackMode"] = value;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Bindable(true), Category("Client-Side Events"), Description("Property used to define the Client-Side Events for the Grid."), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerProperty)]
        public GridClientSideEvents ClientSideEvents
        {
            get
            {
                return this._clientSideEvents;
            }
            set
            {
                this._clientSideEvents = value;
            }
        }

        [Category("Columns"), PersistenceMode(PersistenceMode.InnerProperty), Description("Grid Option collection."), NotifyParentProperty(true)]
        public ColumnCollection Columns
        {
            get
            {
                if (this.Cols == null)
                {
                    this.Cols = new ColumnCollection();
                    this.Cols.Grid = this;
                }
                return this.Cols;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gAL"), Description("CSS class for the add/edit/delete/cancel/update links"), Browsable(false)]
        public string CSSActionLink
        {
            get
            {
                return this.CssSettings.CSSActionLink;
            }
            set
            {
                this.CssSettings.CSSActionLink = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gALF"), Description("CSS class for the add/save/cancel links from the footer"), Browsable(false)]
        public string CSSActionLinkFooter
        {
            get
            {
                return this.CssSettings.CSSActionLinkFooter;
            }
            set
            {
                this.CssSettings.CSSActionLinkFooter = value;
            }
        }

        [DefaultValue("ob_gBody"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Category("CSS Properties"), Bindable(true), Description("CSS class for the body of the Grid"), Browsable(false)]
        public string CSSBody
        {
            get
            {
                object obj2 = this.ViewState["CSSBody"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "ob_gBody";
            }
            set
            {
                this.ViewState["CSSBody"] = value;
            }
        }

        [Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Category("CSS Properties"), DefaultValue("ob_gBCont"), Description("CSS class for the DIV containing the body of the Grid")]
        public string CSSBodyContainer
        {
            get
            {
                return this.CssSettings.CSSBodyContainer;
            }
            set
            {
                this.CssSettings.CSSBodyContainer = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gBF"), Description("CSS class for the small horizontal bar at the bottom of the grid's body"), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSBodyFooter
        {
            get
            {
                return this.CssSettings.CSSBodyFooter;
            }
            set
            {
                this.CssSettings.CSSBodyFooter = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gBH"), Description("CSS class for the small horizontal bar at the top of the grid's body"), Browsable(false)]
        public string CSSBodyHeader
        {
            get
            {
                return this.CssSettings.CSSBodyHeader;
            }
            set
            {
                this.CssSettings.CSSBodyHeader = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gC"), Description("CSS class for the cells of the grid"), Browsable(false)]
        public string CSSCell
        {
            get
            {
                return this.CssSettings.CSSCell;
            }
            set
            {
                this.CssSettings.CSSCell = value;
            }
        }

        [DefaultValue("ob_gCP"), Bindable(true), Category("CSS Properties"), Description("CSS Class for the small div used as left padding for the cells"), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSCellPadding
        {
            get
            {
                return this.CssSettings.CSSCellPadding;
            }
            set
            {
                this.CssSettings.CSSCellPadding = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gCTA"), Description("CSS class for the temporary added records."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSCellTemporaryAdded
        {
            get
            {
                return this.CssSettings.CSSCellTemporaryAdded;
            }
            set
            {
                this.CssSettings.CSSCellTemporaryAdded = value;
            }
        }

        [Description("CSS class for the temporary deleted records."), Category("CSS Properties"), DefaultValue("ob_gCTD"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSCellTemporaryDeleted
        {
            get
            {
                return this.CssSettings.CSSCellTemporaryDeleted;
            }
            set
            {
                this.CssSettings.CSSCellTemporaryDeleted = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gCTE"), Description("CSS class for the temporary edited records."), Browsable(false)]
        public string CSSCellTemporaryEdited
        {
            get
            {
                return this.CssSettings.CSSCellTemporaryEdited;
            }
            set
            {
                this.CssSettings.CSSCellTemporaryEdited = value;
            }
        }

        [Browsable(false)]
        public override string CssClass
        {
            get
            {
                return base.CssClass;
            }
            set
            {
                base.CssClass = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gCH"), Description("CSS class for the header of each column."), Browsable(false)]
        public string CSSColumnHeader
        {
            get
            {
                return this.CssSettings.CSSColumnHeader;
            }
            set
            {
                this.CssSettings.CSSColumnHeader = value;
            }
        }

        [DefaultValue("ob_gHA"), Bindable(true), Category("CSS Properties"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Description("CSS class for the up/down arrows (from the header)"), Browsable(false)]
        public string CSSColumnHeaderArrow
        {
            get
            {
                return this.CssSettings.CSSColumnHeaderArrow;
            }
            set
            {
                this.CssSettings.CSSColumnHeaderArrow = value;
            }
        }

        [Description("CSS class for the grid container."), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gMCont"), Browsable(false)]
        public string CSSContainer
        {
            get
            {
                return this.CssSettings.CSSContainer;
            }
            set
            {
                this.CssSettings.CSSContainer = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gEC"), Description("CSS class for the default controls used in the templates for edit"), Browsable(false)]
        public string CSSEditControl
        {
            get
            {
                return this.CssSettings.CSSEditControl;
            }
            set
            {
                this.CssSettings.CSSEditControl = value;
            }
        }

        [DefaultValue(""), Bindable(true), Category("CSS Properties"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Description("Style for the cells from the exported file (Excel / Word)."), Browsable(false)]
        public string CSSExportCellStyle
        {
            get
            {
                return this.CssSettings.CSSExportCellStyle;
            }
            set
            {
                this.CssSettings.CSSExportCellStyle = value;
            }
        }

        [DefaultValue(""), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), Description("Style for the header cells from the exported file (Excel / Word)."), Browsable(false)]
        public string CSSExportHeaderCellStyle
        {
            get
            {
                return this.CssSettings.CSSExportHeaderCellStyle;
            }
            set
            {
                this.CssSettings.CSSExportHeaderCellStyle = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue(""), Description("Style for the table with data from the exported file (Excel / Word)."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSExportTableStyle
        {
            get
            {
                return this.CssSettings.CSSExportTableStyle;
            }
            set
            {
                this.CssSettings.CSSExportTableStyle = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gHFC"), Description("CSS class for the cells of the filter."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFilterCell
        {
            get
            {
                return this.CssSettings.CSSFilterCell;
            }
            set
            {
                this.CssSettings.CSSFilterCell = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gFC_N"), Description("CSS class for the filter criterias."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFilterCriteria
        {
            get
            {
                return this.CssSettings.CSSFilterCriteria;
            }
            set
            {
                this.CssSettings.CSSFilterCriteria = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gFC_H"), Description("CSS class for the filter criterias."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFilterCriteriaHover
        {
            get
            {
                return this.CssSettings.CSSFilterCriteriaHover;
            }
            set
            {
                this.CssSettings.CSSFilterCriteriaHover = value;
            }
        }

        [Description("CSS class for the button that opens the filter criterias selector."), Category("CSS Properties"), DefaultValue("ob_gFCB"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFilterCriteriasButton
        {
            get
            {
                return this.CssSettings.CSSFilterCriteriasButton;
            }
            set
            {
                this.CssSettings.CSSFilterCriteriasButton = value;
            }
        }

        [Description("CSS class for the container of the filter criterias."), Category("CSS Properties"), DefaultValue("ob_gFCC"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFilterCriteriasContainer
        {
            get
            {
                return this.CssSettings.CSSFilterCriteriasContainer;
            }
            set
            {
                this.CssSettings.CSSFilterCriteriasContainer = value;
            }
        }

        [Description("CSS class for the textbox which contains the filter criteria."), Category("CSS Properties"), DefaultValue("ob_gFCT"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFilterCriteriaTextbox
        {
            get
            {
                return this.CssSettings.CSSFilterCriteriaTextbox;
            }
            set
            {
                this.CssSettings.CSSFilterCriteriaTextbox = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gDFSC"), Description("CSS class for the small cell of the filter under the vertical scrollbar."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFilterScrollingSpacer
        {
            get
            {
                return this.CssSettings.CSSFilterScrollingSpacer;
            }
            set
            {
                this.CssSettings.CSSFilterScrollingSpacer = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue(""), Description("Path to folder with images"), Browsable(false)]
        public string CSSFolderImages
        {
            get
            {
                return this.CssSettings.CSSFolderImages;
            }
            set
            {
                this.CssSettings.CSSFolderImages = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gF"), Description("CSS class for the footer of the grid"), Browsable(false)]
        public string CSSFooter
        {
            get
            {
                return this.CssSettings.CSSFooter;
            }
            set
            {
                this.CssSettings.CSSFooter = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gFContent"), Description("CSS class for the container of the pagination/navigation buttons"), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFooterPageNavContainer
        {
            get
            {
                return this.CssSettings.CSSFooterPageNavContainer;
            }
            set
            {
                this.CssSettings.CSSFooterPageNavContainer = value;
            }
        }

        [Category("CSS Properties"), Bindable(true), DefaultValue("ob_gFRP"), Description("CSS class for the \"Records: ... Pages: ...\" text from the footer"), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSFooterRecordsPages
        {
            get
            {
                return this.CssSettings.CSSFooterRecordsPages;
            }
            set
            {
                this.CssSettings.CSSFooterRecordsPages = value;
            }
        }

        [Description("CSS Class for the moving column that is dragged with the mouse for grouping."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Category("CSS Properties"), DefaultValue("ob_gGDC"), Bindable(true)]
        public string CSSGroupDraggingColumn
        {
            get
            {
                return this.CssSettings.CSSGroupDraggingColumn;
            }
            set
            {
                this.CssSettings.CSSGroupDraggingColumn = value;
            }
        }

        [Browsable(false), Description("CSS Class for the area where columns are dropped in order to group them"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), DefaultValue("ob_gGA"), Category("CSS Properties")]
        public string CSSGroupingArea
        {
            get
            {
                return this.CssSettings.CSSGroupingArea;
            }
            set
            {
                this.CssSettings.CSSGroupingArea = value;
            }
        }

        [Description("CSS Class for the bottom arrow which indicates the destination of the moving column."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Category("CSS Properties"), DefaultValue("ob_gGABA"), Bindable(true)]
        public string CSSGroupingAreaBottomArrow
        {
            get
            {
                return this.CssSettings.CSSGroupingAreaBottomArrow;
            }
            set
            {
                this.CssSettings.CSSGroupingAreaBottomArrow = value;
            }
        }

        [Description("CSS Class for the columns in the grouping area."), Category("CSS Properties"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), DefaultValue("ob_gGAC"), Browsable(false)]
        public string CSSGroupingAreaColumn
        {
            get
            {
                return this.CssSettings.CSSGroupingAreaColumn;
            }
            set
            {
                this.CssSettings.CSSGroupingAreaColumn = value;
            }
        }

        [Browsable(false), Description("CSS Class that is used to highlight the column from the grouping area when it's dragged with the mouse."), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Category("CSS Properties"), Bindable(true), DefaultValue("ob_gGACHWD")]
        public string CSSGroupingAreaColumnHighlightedWhenDragging
        {
            get
            {
                return this.CssSettings.CSSGroupingAreaColumnHighlightedWhenDragging;
            }
            set
            {
                this.CssSettings.CSSGroupingAreaColumnHighlightedWhenDragging = value;
            }
        }

        [Description("CSS Class for the spacer that is placed between the columns moved in the grouping area."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gGACS")]
        public string CSSGroupingAreaColumnSpacer
        {
            get
            {
                return this.CssSettings.CSSGroupingAreaColumnSpacer;
            }
            set
            {
                this.CssSettings.CSSGroupingAreaColumnSpacer = value;
            }
        }

        [DefaultValue("ob_gGADC"), Description("CSS Class for the default column which appears in the grouping area"), Bindable(true), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Category("CSS Properties"), Browsable(false)]
        public string CSSGroupingAreaDefaultColumn
        {
            get
            {
                return this.CssSettings.CSSGroupingAreaDefaultColumn;
            }
            set
            {
                this.CssSettings.CSSGroupingAreaDefaultColumn = value;
            }
        }

        [Bindable(true), DefaultValue("ob_gGATA"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Description("CSS Class for the top arrow which indicates the destination of the moving column."), Browsable(false), Category("CSS Properties")]
        public string CSSGroupingAreaTopArrow
        {
            get
            {
                return this.CssSettings.CSSGroupingAreaTopArrow;
            }
            set
            {
                this.CssSettings.CSSGroupingAreaTopArrow = value;
            }
        }

        [Category("CSS Properties"), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), DefaultValue("ob_gH"), Description("CSS class for the grid header.")]
        public string CSSHeader
        {
            get
            {
                return this.CssSettings.CSSHeader;
            }
            set
            {
                this.CssSettings.CSSHeader = value;
            }
        }

        [DefaultValue("ob_gHCHWG"), Description("CSS Class that is used to highlight the column from the header when it's dragged with the mouse."), Browsable(false), Category("CSS Properties"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true)]
        public string CSSHeaderColumnHighlightedWhenGrouping
        {
            get
            {
                return this.CssSettings.CSSHeaderColumnHighlightedWhenGrouping;
            }
            set
            {
                this.CssSettings.CSSHeaderColumnHighlightedWhenGrouping = value;
            }
        }

        [DefaultValue("ob_gHCont"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Browsable(false), Bindable(true), Category("CSS Properties"), Description("CSS class for the DIV containing the grid header")]
        public string CSSHeaderContainer
        {
            get
            {
                return this.CssSettings.CSSHeaderContainer;
            }
            set
            {
                this.CssSettings.CSSHeaderContainer = value;
            }
        }

        [Description("CSS class for loading message that is displayed when the grid loads data."), Category("CSS Properties"), DefaultValue("ob_gBLM"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSLoadingMessage
        {
            get
            {
                return this.CssSettings.CSSLoadingMessage;
            }
            set
            {
                this.CssSettings.CSSLoadingMessage = value;
            }
        }

        [Description("CSS class for the navigation buttons inside the footer"), Category("CSS Properties"), DefaultValue("ob_gNI"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSNavigationImage
        {
            get
            {
                return this.CssSettings.CSSNavigationImage;
            }
            set
            {
                this.CssSettings.CSSNavigationImage = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gPLCL"), Description("CSS class for the paging links from the footer"), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSNavigationLink
        {
            get
            {
                return this.CssSettings.CSSNavigationLink;
            }
            set
            {
                this.CssSettings.CSSNavigationLink = value;
            }
        }

        [Description("CSS class for the pages separator from the footer."), Category("CSS Properties"), DefaultValue("ob_gPLS"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSNavigationSeparator
        {
            get
            {
                return this.CssSettings.CSSNavigationSeparator;
            }
            set
            {
                this.CssSettings.CSSNavigationSeparator = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gPLD"), Description("CSS class for the selected page from the footer"), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSNavigationText
        {
            get
            {
                return this.CssSettings.CSSNavigationText;
            }
            set
            {
                this.CssSettings.CSSNavigationText = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gNRM"), Description("CSS class for the cell containing the message displayed when the grid has no records."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSNoRecordsMessage
        {
            get
            {
                return this.CssSettings.CSSNoRecordsMessage;
            }
            set
            {
                this.CssSettings.CSSNoRecordsMessage = value;
            }
        }

        [DefaultValue("ob_gPSS"), Bindable(true), Category("CSS Properties"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Description("CSS class for the page size selector"), Browsable(false)]
        public string CSSPageSizeSelector
        {
            get
            {
                return this.CssSettings.CSSPageSizeSelector;
            }
            set
            {
                this.CssSettings.CSSPageSizeSelector = value;
            }
        }

        [DefaultValue("ob_gPST"), Bindable(true), Category("CSS Properties"), Description("CSS class for the text near the page size selector."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSPageSizeText
        {
            get
            {
                return this.CssSettings.CSSPageSizeText;
            }
            set
            {
                this.CssSettings.CSSPageSizeText = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gR"), Description("CSS class for the records of the grid"), Browsable(false)]
        public string CSSRecord
        {
            get
            {
                return this.CssSettings.CSSRecord;
            }
            set
            {
                this.CssSettings.CSSRecord = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gRA"), Description("CSS class for the alternate records of the grid"), Browsable(false)]
        public string CSSRecordAlternate
        {
            get
            {
                return this.CssSettings.CSSRecordAlternate;
            }
            set
            {
                this.CssSettings.CSSRecordAlternate = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Category("CSS Properties"), DefaultValue("ob_gRGH"), Description("CSS class for the header of a group of records"), Browsable(false)]
        public string CSSRecordGroupHeader
        {
            get
            {
                return this.CssSettings.CSSRecordGroupHeader;
            }
            set
            {
                this.CssSettings.CSSRecordGroupHeader = value;
            }
        }

        [DefaultValue("ob_gRGHB"), Bindable(true), Category("CSS Properties"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Description("CSS class for the +/- image from the header of a group of records."), Browsable(false)]
        public string CSSRecordGroupHeaderButton
        {
            get
            {
                return this.CssSettings.CSSRecordGroupHeaderButton;
            }
            set
            {
                this.CssSettings.CSSRecordGroupHeaderButton = value;
            }
        }

        [DefaultValue("ob_gRGHC"), Bindable(true), Category("CSS Properties"), Description("CSS class for the header of a group of records"), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSRecordGroupHeaderCell
        {
            get
            {
                return this.CssSettings.CSSRecordGroupHeaderCell;
            }
            set
            {
                this.CssSettings.CSSRecordGroupHeaderCell = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gRH"), Description("The background of the records when the mouse is over them."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSRecordHover
        {
            get
            {
                return this.CssSettings.CSSRecordHover;
            }
            set
            {
                this.CssSettings.CSSRecordHover = value;
            }
        }

        [Description("CSS class for the selected records of the grid"), Category("CSS Properties"), DefaultValue("ob_gRS"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSRecordSelected
        {
            get
            {
                return this.CssSettings.CSSRecordSelected;
            }
            set
            {
                this.CssSettings.CSSRecordSelected = value;
            }
        }

        [Bindable(true), Category("CSS Properties"), DefaultValue("ob_gRL"), Description("CSS class for the resizing vertical bars."), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSResizeLines
        {
            get
            {
                return this.CssSettings.CSSResizeLines;
            }
            set
            {
                this.CssSettings.CSSResizeLines = value;
            }
        }

        [DefaultValue("ob_gRT"), Category("CSS Properties"), Browsable(false), Bindable(true), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Description("CSS Class for the tooltip that appears when columns are resized")]
        public string CSSResizingTooltip
        {
            get
            {
                return this.CssSettings.CSSResizingTooltip;
            }
            set
            {
                this.CssSettings.CSSResizingTooltip = value;
            }
        }

        [Description("CSS class for the row edit template"), Category("CSS Properties"), DefaultValue("ob_gRETpl"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false)]
        public string CSSRowEditTemplate
        {
            get
            {
                return this.CssSettings.CSSRowEditTemplate;
            }
            set
            {
                this.CssSettings.CSSRowEditTemplate = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Bindable(true), Description("CSS class for the small cell above the vertical scrollbar"), Browsable(false), DefaultValue("ob_gDSC"), Category("CSS Properties")]
        public string CSSScrollingSpacer
        {
            get
            {
                return this.CssSettings.CSSScrollingSpacer;
            }
            set
            {
                this.CssSettings.CSSScrollingSpacer = value;
            }
        }

        [DefaultValue("ob_gSA"), Bindable(true), Category("CSS Properties"), Obsolete("This property is obsolete. Please use the CssSettings property to set the css properties for the Grid.", false), Description("CSS class for the selection area that appears when dragging with the mouse for selecting records"), Browsable(false)]
        public string CSSSelectionArea
        {
            get
            {
                return this.CssSettings.CSSSelectionArea;
            }
            set
            {
                this.CssSettings.CSSSelectionArea = value;
            }
        }

        [Description("Property used to define the CSS Settings for the Grid."), PersistenceMode(PersistenceMode.InnerProperty), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Category("Appearance"), NotifyParentProperty(true), Bindable(true)]
        public GridCssSettings CssSettings
        {
            get
            {
                return this._cssSettings;
            }
            set
            {
                this._cssSettings = value;
            }
        }

        [Description("The index of the current page."), Category("Paging"), Bindable(true), DefaultValue(0)]
        public int CurrentPageIndex
        {
            get
            {
                object obj2 = this.ViewState["CurrentPageIndex"];
                if (obj2 != null)
                {
                    return (int) obj2;
                }
                return 0;
            }
            set
            {
                if ((this.ViewState["CurrentPageIndex"] == null) || (value != ((int) this.ViewState["CurrentPageIndex"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["CurrentPageIndex"] = value;
            }
        }

        public override object DataSource
        {
            get
            {
                return base.DataSource;
            }
            set
            {
                if ((!this.preventPreviousDataSourceClearing && this.Serialize) && this.IsPostBack)
                {
                    if (this.AutoGenerateColumns)
                    {
                        this.AutoGeneratedColumnsCreated = false;
                        this.Columns.Clear();
                    }
                    this.GroupBy = "";
                    this.__ViewState = "";
                }
                base.DataSource = value;
            }
        }

        protected virtual bool DataSourceControlCanPage
        {
            get
            {
                return this.GetData().CanPage;
            }
        }

        [Bindable(true), PersistenceMode(PersistenceMode.InnerProperty), Category("Master/Detail"), NotifyParentProperty(true)]
        public DetailGridCollection DetailGrids
        {
            get
            {
                if (this.detailGrids == null)
                {
                    this.detailGrids = new DetailGridCollection();
                }
                return this.detailGrids;
            }
        }

        [Description("If true, the filtering expression will be embedded into the sort expression passed to DataSourceControls."), Category("Filtering"), DefaultValue(false), Bindable(true)]
        public bool EmbedFilterInSortExpression
        {
            get
            {
                object obj2 = this.ViewState["EmbedFilterInSortExpression"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["EmbedFilterInSortExpression"] == null) || (value != ((bool) this.ViewState["EmbedFilterInSortExpression"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["EmbedFilterInSortExpression"] = value;
            }
        }

        [Browsable(false)]
        public override bool Enabled
        {
            get
            {
                return base.Enabled;
            }
            set
            {
                base.Enabled = value;
            }
        }

        [Bindable(true), Category("Settings"), DefaultValue(false), Description("If set to true, the records will have an hover effect when the mouse is over the record.")]
        public bool EnableRecordHover
        {
            get
            {
                object obj2 = this.ViewState["EnableRecordHover"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["EnableRecordHover"] == null) || (value != ((bool) this.ViewState["EnableRecordHover"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["EnableRecordHover"] = value;
            }
        }

        [Browsable(false)]
        public override bool EnableTheming
        {
            get
            {
                return base.EnableTheming;
            }
            set
            {
                base.EnableTheming = value;
            }
        }

        [Description("Enable type validation for the grid - this is used for add/edit actions"), Bindable(true), Category("Add/Edit/Delete"), DefaultValue(true)]
        public bool EnableTypeValidation
        {
            get
            {
                object obj2 = this.ViewState["EnableTypeValidation"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["EnableTypeValidation"] == null) || (value != ((bool) this.ViewState["EnableTypeValidation"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["EnableTypeValidation"] = value;
            }
        }

        [Browsable(false)]
        public override bool EnableViewState
        {
            get
            {
                return base.EnableViewState;
            }
            set
            {
                base.EnableViewState = value;
            }
        }

        [Category("Exporting"), DefaultValue(0), Description("Sets the life time for the exported files."), Obsolete("This property is obsolete. Please use the ExportingSettings property to set the exporting properties for the Grid.", false), Browsable(false), Bindable(true)]
        public int ExportedFilesLifeTime
        {
            get
            {
                return this.ExportingSettings.ExportedFilesLifeTime;
            }
            set
            {
                this.ExportingSettings.ExportedFilesLifeTime = value;
            }
        }

        [Browsable(false), Bindable(true), Obsolete("This property is obsolete. Please use the ExportingSettings property to set the exporting properties for the Grid.", false), Category("Exporting"), DefaultValue(0), Description("The browser window where the exported file should be opened.")]
        public ExportedFilesTargetWindowType ExportedFilesTargetWindow
        {
            get
            {
                return this.ExportingSettings.ExportedFilesTargetWindow;
            }
            set
            {
                this.ExportingSettings.ExportedFilesTargetWindow = value;
            }
        }

        [Category("Exporting"), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerProperty), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Description("Property used to define the exporting settings for the Grid."), Bindable(true)]
        public GridExportingSettings ExportingSettings
        {
            get
            {
                return this._exportingSettings;
            }
            set
            {
                this._exportingSettings = value;
            }
        }

        [Description("Template for the \"Apply Filter\" button."), Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), Browsable(false), Bindable(true), Category("Templates"), DefaultValue("")]
        public string FilterApplyButton_TemplateId
        {
            set
            {
                this._templateSettings.FilterApplyButton_TemplateId = value;
            }
        }

        [Category("Filtering"), DefaultValue(""), Bindable(true), Description("The expression that will be used for filtering.")]
        public string FilterExpression
        {
            get
            {
                object obj2 = this.ViewState["FilterExpression"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                if ((this.ViewState["FilterExpression"] == null) || (value != this.ViewState["FilterExpression"].ToString()))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["FilterExpression"] = value;
            }
        }

        [Browsable(false), Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), Bindable(true), Category("Templates"), DefaultValue(""), Description("Template for the \"Hide Filter\" button.")]
        public string FilterHideButton_TemplateId
        {
            set
            {
                this._templateSettings.FilterHideButton_TemplateId = value;
            }
        }

        [Bindable(true), PersistenceMode(PersistenceMode.InnerProperty), Description("Property used to define the filtering settings for the Grid."), NotifyParentProperty(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Category("Filtering")]
        public GridFilteringSettings FilteringSettings
        {
            get
            {
                return this.filteringSettings;
            }
            set
            {
                this.filteringSettings = value;
            }
        }

        [Category("Templates"), Browsable(false), Bindable(true), Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), DefaultValue(""), Description("Template for the \"Remove Filter\" button.")]
        public string FilterRemoveButton_TemplateId
        {
            set
            {
                this._templateSettings.FilterRemoveButton_TemplateId = value;
            }
        }

        [Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), Category("Templates"), DefaultValue(""), Description("Template for the \"Show Filter\" button.")]
        public string FilterShowButton_TemplateId
        {
            set
            {
                this._templateSettings.FilterShowButton_TemplateId = value;
            }
        }

        [Category("Filtering"), Description("The type of filter to be used."), Bindable(true), DefaultValue(0)]
        public GridFilterType FilterType
        {
            get
            {
                object obj2 = this.ViewState["FilterType"];
                if (obj2 != null)
                {
                    return (GridFilterType) obj2;
                }
                return GridFilterType.Normal;
            }
            set
            {
                if ((this.ViewState["FilterType"] == null) || (value != ((GridFilterType) this.ViewState["FilterType"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["FilterType"] = value;
            }
        }

        [Category("Exporting"), Description("The name of the folder where the exported Excel/Word files will be written."), Editor(typeof(GridSpecialFolderEditor), typeof(UITypeEditor)), Bindable(true), DefaultValue(".")]
        public string FolderExports
        {
            get
            {
                object obj2 = this.ViewState["FolderExports"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return ".";
            }
            set
            {
                if ((this.ViewState["FolderExports"] == null) || (value != this.ViewState["FolderExports"].ToString()))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["FolderExports"] = value;
            }
        }

        [Bindable(true), Category("Localization"), Description("Path to folder with xml files for localization"), Editor(typeof(GridSpecialFolderEditor), typeof(UITypeEditor)), DefaultValue("localization")]
        public string FolderLocalization
        {
            get
            {
                object obj2 = this.ViewState["FolderLocalization"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "localization";
            }
            set
            {
                if ((this.ViewState["FolderLocalization"] == null) || (value != this.ViewState["FolderLocalization"].ToString()))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["FolderLocalization"] = value;
            }
        }

        [Bindable(true), Obsolete("This property is obsolete. The JavaScript code is embedded into the aseembly, no external files are required.", false), Browsable(false), Category("Grid Settings"), DefaultValue("grid/gridscript"), Description("Path to Grid javascript file.")]
        public string FolderScript
        {
            get
            {
                string str = (string) this.ViewState["FolderScript"];
                if (str == null)
                {
                    this.ViewState["FolderScript"] = "grid/gridscript";
                    return "grid/gridscript";
                }
                return str;
            }
            set
            {
                this.ViewState["FolderScript"] = value;
            }
        }

        [Bindable(true), Editor(typeof(GridSpecialFolderEditor), typeof(UITypeEditor)), Category("Appearance"), DefaultValue(""), Description("Path to folder with Grid style.")]
        public string FolderStyle
        {
            get
            {
                string str = (string) this.ViewState["FolderStyle"];
                if (str != null)
                {
                    return str;
                }
                return "";
            }
            set
            {
                if ((this.ViewState["FolderStyle"] == null) || (value != this.ViewState["FolderStyle"].ToString()))
                {
                    this.NeedRebinding = true;
                    if ((this.ViewState["FolderStyle"] != null) && (value != this.ViewState["FolderStyle"].ToString()))
                    {
                        if (!this.IsDesignTimeRender && HttpContext.Current.Items.Contains("vdcGrid_StyleSheetAdded"))
                        {
                            HttpContext.Current.Items.Remove("vdcGrid_StyleSheetAdded");
                        }
                        this.NeedsRebindForStyleSheet = true;
                    }
                }
                this.ViewState["FolderStyle"] = value;
            }
        }

        [Browsable(false)]
        public override FontInfo Font
        {
            get
            {
                return base.Font;
            }
        }

        [Browsable(false)]
        public override Color ForeColor
        {
            get
            {
                return base.ForeColor;
            }
            set
            {
                base.ForeColor = value;
            }
        }

        [Description("If set to true, the grid will generate IDs for the TR elements that contain the records."), Bindable(true), Category("Settings"), DefaultValue(false)]
        public bool GenerateRecordIds
        {
            get
            {
                object obj2 = this.ViewState["GenerateRecordIds"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["GenerateRecordIds"] == null) || (value != ((bool) this.ViewState["GenerateRecordIds"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["GenerateRecordIds"] = value;
            }
        }

        internal string GridID
        {
            get
            {
                if (string.IsNullOrEmpty(this.gridID))
                {
                    this.gridID = this.getId();
                }
                return this.gridID;
            }
        }

        [Description("Sets the expression for the Grouping feature."), Category("Grouping"), Bindable(true), DefaultValue("")]
        public string GroupBy
        {
            get
            {
                object obj2 = this.ViewState["GroupBy"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                if ((this.ViewState["GroupBy"] == null) || (value != this.ViewState["GroupBy"].ToString()))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["GroupBy"] = value;
            }
        }

        [Category("Grouping"), PersistenceMode(PersistenceMode.InnerProperty), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Bindable(true), Description("Property used to define the grouping settings for the Grid."), NotifyParentProperty(true)]
        public GridGroupingSettings GroupingSettings
        {
            get
            {
                return this.groupingSettings;
            }
            set
            {
                this.groupingSettings = value;
            }
        }

        internal bool HasColumnsWithFixedAndPercentageWidth
        {
            get
            {
                bool flag = false;
                bool flag2 = false;
                if (!this.hasColumnsWithFixedAndPercentageWidthCalculated)
                {
                    foreach (Column column in this.Cols)
                    {
                        if (column.Width.IndexOf("%") == -1)
                        {
                            flag = true;
                        }
                        else
                        {
                            flag2 = true;
                        }
                    }
                    if (flag && flag2)
                    {
                        this.hasColumnsWithFixedAndPercentageWidth = true;
                    }
                    this.hasColumnsWithFixedAndPercentageWidthCalculated = true;
                }
                return this.hasColumnsWithFixedAndPercentageWidth;
            }
        }

        [DefaultValue(typeof(Unit), "0px"), Browsable(true)]
        public override Unit Height
        {
            get
            {
                if (base.Height.IsEmpty)
                {
                    return Unit.Pixel(0);
                }
                return base.Height;
            }
            set
            {
                Unit height = base.Height;
                if (value != base.Height)
                {
                    this.NeedRebinding = true;
                }
                base.Height = value;
            }
        }

        [Description("If true, the columns that are used for grouping will be hidden."), DefaultValue(false), Bindable(true), Category("Grouping")]
        public bool HideColumnsWhenGrouping
        {
            get
            {
                object obj2 = this.ViewState["HideColumnsWhenGrouping"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["HideColumnsWhenGrouping"] == null) || (value != ((bool) this.ViewState["HideColumnsWhenGrouping"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["HideColumnsWhenGrouping"] = value;
            }
        }

        internal int IndexOfFirstVisibleColumn
        {
            get
            {
                foreach (Column column in this.Cols)
                {
                    if (column.Visible)
                    {
                        this.indexOfFirstVisibleColumn = column.Index;
                        break;
                    }
                }
                return this.indexOfFirstVisibleColumn;
            }
        }

        internal int IndexOfLastVisibleColumn
        {
            get
            {
                foreach (Column column in this.Cols)
                {
                    if (column.Visible)
                    {
                        this.indexOfLastVisibleColumn = column.Index;
                    }
                }
                return this.indexOfLastVisibleColumn;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public bool IsCallback
        {
            get
            {
                return this._IsCallback;
            }
            set
            {
                this._IsCallback = value;
            }
        }

        internal bool IsDesignTimeRender
        {
            get
            {
                if (!this._isDesignTimeRenderChecked)
                {
                    try
                    {
                        if ((base.Site != null) && base.Site.DesignMode)
                        {
                            this._isDesignTimeRender = true;
                        }
                        else
                        {
                            this._isDesignTimeRender = false;
                        }
                        this._isDesignTimeRenderChecked = true;
                    }
                    catch (Exception exception1)
                    {
                        if (exception1 != null)
                        {
                        }
                        this._isDesignTimeRender = false;
                    }
                }
                return this._isDesignTimeRender;
            }
        }

        [Bindable(true), Category("Selecting Records"), DefaultValue(true), Description("If set to true, the selected records will keep their state through callbacks/postbacks")]
        public bool KeepSelectedRecords
        {
            get
            {
                object obj2 = this.ViewState["KeepSelectedRecords"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["KeepSelectedRecords"] == null) || (value != ((bool) this.ViewState["KeepSelectedRecords"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["KeepSelectedRecords"] = value;
            }
        }

        [Description("Name of the used language"), Category("Localization"), Bindable(true), DefaultValue("")]
        public string Language
        {
            get
            {
                object obj2 = this.ViewState["Language"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                if ((this.ViewState["Language"] == null) || (value != this.ViewState["Language"].ToString()))
                {
                    this.NeedRebinding = true;
                    this.forceLanguageReloading = true;
                }
                this.ViewState["Language"] = value;
            }
        }

        [Description("Property used to define the Localization Settings for the Grid."), Bindable(true), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerProperty), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), Category("Localization")]
        public GridLocalizationSettings LocalizationSettings
        {
            get
            {
                return this._localizationSettings;
            }
            set
            {
                this._localizationSettings = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), Browsable(false), Bindable(true), Category("Templates"), DefaultValue(""), Description("Template for the manual paging section from the footer.")]
        public string ManualPagingTemplateId
        {
            set
            {
                this._templateSettings.ManualPagingTemplateId = value;
            }
        }

        [NotifyParentProperty(true), Category("Master/Detail"), Description("Defines the settings for the master/detail feature."), Bindable(true), PersistenceMode(PersistenceMode.InnerProperty), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public GridMasterDetailSettings MasterDetailSettings
        {
            get
            {
                return this._masterDetailSettings;
            }
            set
            {
                this._masterDetailSettings = value;
            }
        }

        [Bindable(true), Browsable(false), Category("Selecting Records"), DefaultValue(false)]
        private bool MultiPageSelectionLoaded
        {
            get
            {
                object obj2 = this.ViewState["MultiPageSelectionLoaded"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                this.ViewState["MultiPageSelectionLoaded"] = value;
            }
        }

        [Bindable(true), Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), Browsable(false), Category("Templates"), DefaultValue(""), Description("Template for the \"Save All | Cancel All\" buttons.")]
        public string MultiRecordSaveCancel_TemplateId
        {
            set
            {
                this._templateSettings.MultiRecordSaveCancel_TemplateId = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), Browsable(false), Bindable(true), Category("Templates"), DefaultValue(""), Description("Template for the \"Save | Cancel\" buttons.")]
        public string NewRecord_EditTemplateId
        {
            set
            {
                this._templateSettings.NewRecord_EditTemplateId = value;
            }
        }

        [Description("Template for the \"Add new\" button."), Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), Browsable(false), Bindable(true), Category("Templates"), DefaultValue("")]
        public string NewRecord_TemplateId
        {
            set
            {
                this._templateSettings.NewRecord_TemplateId = value;
            }
        }

        [DefaultValue(5), Bindable(true), Description("Sets the number of pages displayed in the footer."), Category("Paging")]
        public int NumberOfPagesShownInFooter
        {
            get
            {
                object obj2 = this.ViewState["NumberOfPagesShownInFooter"];
                if (obj2 != null)
                {
                    return (int) obj2;
                }
                return 5;
            }
            set
            {
                if ((this.ViewState["NumberOfPagesShownInFooter"] == null) || (value != ((int) this.ViewState["NumberOfPagesShownInFooter"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["NumberOfPagesShownInFooter"] = value;
            }
        }

        [Category("Client-Side Events"), Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), Bindable(true), Browsable(false), DefaultValue(""), Description("Client-side function to be executed before a record is deleted.")]
        public string OnBeforeClientDelete
        {
            get
            {
                return this.ClientSideEvents.OnBeforeClientDelete;
            }
            set
            {
                this.ClientSideEvents.OnBeforeClientDelete = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), Bindable(true), Browsable(false), Category("Client-Side Events"), DefaultValue(""), Description("Client-side function to be executed before a new record is inserted.")]
        public string OnBeforeClientInsert
        {
            get
            {
                return this.ClientSideEvents.OnBeforeClientInsert;
            }
            set
            {
                this.ClientSideEvents.OnBeforeClientInsert = value;
            }
        }

        [Category("Client-Side Events"), Bindable(true), Browsable(false), Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), DefaultValue(""), Description("Client-side function to be executed before a record is updated.")]
        public string OnBeforeClientUpdate
        {
            get
            {
                return this.ClientSideEvents.OnBeforeClientUpdate;
            }
            set
            {
                this.ClientSideEvents.OnBeforeClientUpdate = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), DefaultValue(""), Bindable(true), Browsable(false), Category("Client-Side Events"), Description("Client-side function to be executed after a callback.")]
        public string OnClientCallback
        {
            get
            {
                return this.ClientSideEvents.OnClientCallback;
            }
            set
            {
                this.ClientSideEvents.OnClientCallback = value;
            }
        }

        [DefaultValue(""), Category("Client-Side Events"), Bindable(true), Description("Client-side function to be executed when an error appears after a callback."), Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), Browsable(false)]
        public string OnClientCallbackError
        {
            get
            {
                return this.ClientSideEvents.OnClientCallbackError;
            }
            set
            {
                this.ClientSideEvents.OnClientCallbackError = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), Bindable(true), Browsable(false), Category("Client-Side Events"), DefaultValue(""), Description("Client-side function to be executed when a record is deleted.")]
        public string OnClientDelete
        {
            get
            {
                return this.ClientSideEvents.OnClientDelete;
            }
            set
            {
                this.ClientSideEvents.OnClientDelete = value;
            }
        }

        [Browsable(false), Description("Client-side function to be executed when a new record is inserted."), Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), Category("Client-Side Events"), DefaultValue(""), Bindable(true)]
        public string OnClientInsert
        {
            get
            {
                return this.ClientSideEvents.OnClientInsert;
            }
            set
            {
                this.ClientSideEvents.OnClientInsert = value;
            }
        }

        [Description("Client-side function to be executed when a record is selected."), Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), Bindable(true), Browsable(false), Category("Client-Side Events"), DefaultValue("")]
        public string OnClientSelect
        {
            get
            {
                return this.ClientSideEvents.OnClientSelect;
            }
            set
            {
                this.ClientSideEvents.OnClientSelect = value;
            }
        }

        [Browsable(false), Obsolete("This property is obsolete. Please use the ClientSideEvents property to set the client-side events for the Grid.", false), Bindable(true), Category("Client-Side Events"), DefaultValue(""), Description("Client-side function to be executed when a record is updated.")]
        public string OnClientUpdate
        {
            get
            {
                return this.ClientSideEvents.OnClientUpdate;
            }
            set
            {
                this.ClientSideEvents.OnClientUpdate = value;
            }
        }

        [Description("Number of records per page."), Category("Paging"), DefaultValue(10), Bindable(true)]
        public int PageSize
        {
            get
            {
                object obj2 = this.ViewState["PageSize"];
                if (obj2 != null)
                {
                    return (int) obj2;
                }
                return 10;
            }
            set
            {
                if ((this.ViewState["PageSize"] == null) || (value != ((int) this.ViewState["PageSize"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["PageSize"] = value;
            }
        }

        [Category("Paging"), DefaultValue("1,2,3,4,5,6,7,8,9,10,50,100,500"), Description("The options for the PageSize drop-down list."), Bindable(true)]
        public string PageSizeOptions
        {
            get
            {
                object obj2 = this.ViewState["PageSizeOptions"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "1,2,3,4,5,6,7,8,9,10,50,100,500";
            }
            set
            {
                if ((this.ViewState["PageSizeOptions"] == null) || (value != this.ViewState["PageSizeOptions"].ToString()))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["PageSizeOptions"] = value;
            }
        }

        [Bindable(true), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), PersistenceMode(PersistenceMode.InnerProperty), Category("Paging"), Description("Property used to define the paging settings for the Grid."), NotifyParentProperty(true)]
        public GridPagingSettings PagingSettings
        {
            get
            {
                return this.pagingSettings;
            }
            set
            {
                this.pagingSettings = value;
            }
        }

        [Bindable(true), Description("Template that will be used for the entire row."), Obsolete("This property is obsolete. Please use the TemplateSettings property to specify the template settings for the Grid.", false), Browsable(false), Category("Templates"), DefaultValue("")]
        public string RowEditTemplateId
        {
            set
            {
                this._templateSettings.RowEditTemplateId = value;
            }
        }

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public virtual GridRowCollection Rows
        {
            get
            {
                this.EnsureChildControls();
                return this.gridRows;
            }
        }

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public virtual GridRowCollection RowsInViewState
        {
            get
            {
                if (this.viewStateRows == null)
                {
                    this.viewStateRows = new GridRowCollection(new List<GridRow>());
                }
                return this.viewStateRows;
            }
        }

        [Browsable(false), Obsolete("This property is obsolete. Please use the ScrollingSettings property to set the scrolling properties for the Grid.", false), Bindable(true), Category("Scrolling"), DefaultValue("0px"), NotifyParentProperty(true), Description("The height for the body containing the records."), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public Unit ScrollHeight
        {
            get
            {
                return this.ScrollingSettings.ScrollHeight;
            }
            set
            {
                this.ScrollingSettings.ScrollHeight = value;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerProperty), Description("Property used to define the scrolling settings for the Grid."), Bindable(true), Category("Scrolling")]
        public GridScrollingSettings ScrollingSettings
        {
            get
            {
                return this._scrollingSettings;
            }
            set
            {
                this._scrollingSettings = value;
            }
        }

        [Bindable(true), Browsable(false), Description("The number of pixels that will be used to scroll the Grid vertically."), Category("Scrolling"), DefaultValue(0), Obsolete("This property is obsolete. Please use the ScrollingSettings property to set the scrolling properties for the Grid.", false)]
        public int ScrollLeft
        {
            get
            {
                return this.ScrollingSettings.ScrollLeft;
            }
            set
            {
                this.ScrollingSettings.ScrollLeft = value;
            }
        }

        [DefaultValue(0), Browsable(false), Bindable(true), Category("Scrolling"), Description("The number of pixels that will be used to scroll the Grid vertically."), Obsolete("This property is obsolete. Please use the ScrollingSettings property to set the scrolling properties for the Grid.", false)]
        public int ScrollTop
        {
            get
            {
                return this.ScrollingSettings.ScrollTop;
            }
            set
            {
                this.ScrollingSettings.ScrollTop = value;
            }
        }

        [Obsolete("This property is obsolete. Please use the ScrollingSettings property to set the scrolling properties for the Grid.", false), Browsable(false), Bindable(true), Category("Scrolling"), DefaultValue("0px"), Description("The width for the body containing the records."), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public Unit ScrollWidth
        {
            get
            {
                return this.ScrollingSettings.ScrollWidth;
            }
            set
            {
                this.ScrollingSettings.ScrollWidth = value;
            }
        }

        public ArrayList SelectedRecords
        {
            get
            {
                return this._SelectedRecords;
            }
            set
            {
                if (this._SelectedRecords != value)
                {
                    this.NeedRebinding = true;
                }
                this._SelectedRecords = value;
                this.CreateSelectedRecordsString();
            }
        }

        [Description("Enables DataSource serialization into ViewState"), Bindable(true), Category("Settings"), DefaultValue(true)]
        public bool Serialize
        {
            get
            {
                object obj2 = this.ViewState["Serialize"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["Serialize"] == null) || (value != ((bool) this.ViewState["Serialize"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["Serialize"] = value;
            }
        }

        [Description("Enables/disables alternating records"), Bindable(true), Category("Appearance"), DefaultValue("true")]
        private bool ShowAlternatingRecords
        {
            get
            {
                object obj2 = this.ViewState["ShowAlternatingRecords"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["ShowAlternatingRecords"] = value;
            }
        }

        [Bindable(true), Category("Grouping"), DefaultValue(false), Description("If true, the groups will initially be collapsed.")]
        public bool ShowCollapsedGroups
        {
            get
            {
                object obj2 = this.ViewState["ShowCollapsedGroups"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["ShowCollapsedGroups"] == null) || (value != ((bool) this.ViewState["ShowCollapsedGroups"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowCollapsedGroups"] = value;
            }
        }

        [Bindable(true), Description("Show the a footer cell for each column."), Category("Layout"), DefaultValue(false)]
        public bool ShowColumnsFooter
        {
            get
            {
                object obj2 = this.ViewState["ShowColumnsFooter"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["ShowColumnsFooter"] == null) || (value != ((bool) this.ViewState["ShowColumnsFooter"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowColumnsFooter"] = value;
            }
        }

        [Category("Layout"), Bindable(true), Description("Show the footer of the grid."), DefaultValue(true)]
        public bool ShowFooter
        {
            get
            {
                object obj2 = this.ViewState["ShowFooter"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["ShowFooter"] == null) || (value != ((bool) this.ViewState["ShowFooter"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowFooter"] = value;
            }
        }

        [Category("Grouping"), DefaultValue(false), Description("If true, a footer row will be added at the bottom of each group."), Bindable(true)]
        public bool ShowGroupFooter
        {
            get
            {
                object obj2 = this.ViewState["ShowGroupFooter"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["ShowGroupFooter"] == null) || (value != ((bool) this.ViewState["ShowGroupFooter"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowGroupFooter"] = value;
            }
        }

        [Description("If true, the groups will have additional information about the records in the header of the group."), Bindable(true), Category("Grouping"), DefaultValue(false)]
        public bool ShowGroupsInfo
        {
            get
            {
                object obj2 = this.ViewState["ShowGroupsInfo"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["ShowGroupsInfo"] == null) || (value != ((bool) this.ViewState["ShowGroupsInfo"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowGroupsInfo"] = value;
            }
        }

        [Bindable(true), Description("Show the header of the grid."), Category("Layout"), DefaultValue(true)]
        public bool ShowHeader
        {
            get
            {
                object obj2 = this.ViewState["ShowHeader"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["ShowHeader"] == null) || (value != ((bool) this.ViewState["ShowHeader"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowHeader"] = value;
            }
        }

        [Category("Settings"), Bindable(true), Description("Enables/disables the displaying of the Loading message."), DefaultValue(true)]
        public bool ShowLoadingMessage
        {
            get
            {
                object obj2 = this.ViewState["ShowLoadingMessage"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["ShowLoadingMessage"] == null) || (value != ((bool) this.ViewState["ShowLoadingMessage"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowLoadingMessage"] = value;
            }
        }

        [Category("Grouping"), Description("If true, the groups that appear on multiple pages will have additional information about the records in the header of the group."), Bindable(true), DefaultValue(true)]
        public bool ShowMultiPageGroupsInfo
        {
            get
            {
                object obj2 = this.ViewState["ShowMultiPageGroupsInfo"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                if ((this.ViewState["ShowMultiPageGroupsInfo"] == null) || (value != ((bool) this.ViewState["ShowMultiPageGroupsInfo"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowMultiPageGroupsInfo"] = value;
            }
        }

        [Description("Show/hide the tooltip that appears when columns are resized"), Bindable(true), DefaultValue(true), Category("Columns")]
        public bool ShowTooltipOnResize
        {
            get
            {
                object obj2 = this.ViewState["ShowTooltipOnResize"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["ShowTooltipOnResize"] = value;
            }
        }

        [Category("Paging"), Description("If true, the total number of pages will be shown in the footer."), Bindable(true), DefaultValue(false)]
        public bool ShowTotalNumberOfPages
        {
            get
            {
                object obj2 = this.ViewState["ShowTotalNumberOfPages"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                if ((this.ViewState["ShowTotalNumberOfPages"] == null) || (value != ((bool) this.ViewState["ShowTotalNumberOfPages"])))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["ShowTotalNumberOfPages"] = value;
            }
        }

        [Browsable(false)]
        public override string SkinID
        {
            get
            {
                return base.SkinID;
            }
            set
            {
                base.SkinID = value;
            }
        }

        [Description("The sorting expression."), Obsolete("This property is obsolete. Use the SortOrder/SortPriority properties of the Column class.", false), Bindable(true), Browsable(false), Category("Sorting"), DefaultValue("")]
        public string SortExpression
        {
            get
            {
                object obj2 = this.ViewState["SortExpression"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                if ((this.ViewState["SortExpression"] == null) || (value != this.ViewState["SortExpression"].ToString()))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["SortExpression"] = value;
            }
        }

        [Browsable(false), Bindable(true), Description("The sorting order: asc/desc."), Category("Sorting"), DefaultValue(""), Obsolete("This property is obsolete. Use the SortOrder/SortPriority properties of the Column class.", false)]
        public string SortOrder
        {
            get
            {
                object obj2 = this.ViewState["SortOrder"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "";
            }
            set
            {
                if ((this.ViewState["SortOrder"] == null) || (value != this.ViewState["SortOrder"].ToString()))
                {
                    this.NeedRebinding = true;
                }
                this.ViewState["SortOrder"] = value;
            }
        }

        [Browsable(false)]
        public override short TabIndex
        {
            get
            {
                return base.TabIndex;
            }
            set
            {
                base.TabIndex = value;
            }
        }

        [PersistenceMode(PersistenceMode.InnerProperty), Category("Templates"), Description("Grid Templates collection."), NotifyParentProperty(true)]
        public TemplatesCollection Templates
        {
            get
            {
                if (this._Templates == null)
                {
                    this._Templates = new TemplatesCollection();
                }
                return this._Templates;
            }
        }

        [Bindable(true), Editor(typeof(GridTemplateSettingsEditor), typeof(UITypeEditor)), Category("Templates"), Description("Property used to define the template settings for the Grid."), NotifyParentProperty(true), PersistenceMode(PersistenceMode.InnerProperty), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public GridTemplateSettings TemplateSettings
        {
            get
            {
                return this._templateSettings;
            }
            set
            {
                this._templateSettings = value;
            }
        }

        [Browsable(false)]
        public override string ToolTip
        {
            get
            {
                return base.ToolTip;
            }
            set
            {
                base.ToolTip = value;
            }
        }

        [Category("Paging"), Description("Gets or sets a value indicating the total number of records from the Grid."), Bindable(true)]
        public int TotalRowCount
        {
            get
            {
                return this.TotalRecords;
            }
        }

        [Browsable(false)]
        public override bool Visible
        {
            get
            {
                return base.Visible;
            }
            set
            {
                base.Visible = value;
            }
        }

        public delegate void DefaultEventHandler(object sender, EventArgs e);

        public delegate void EventHandler(object sender, GridRecordEventArgs e);
    }
}

